Re: [PHP] Converting variables to integer

2002-11-06 Thread Kevin Stone
Ooops my str_replace() function needs one more parameter. str_replace(',', '', $str); -Kevin - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 11:

Re: [PHP] Converting variables to integer

2002-11-06 Thread Marek Kilimajer
This should work for you, this recursive function loops the array, if it gets array again, calls itself function convert2int($var) { foreach($var as $k => $v ) { if(is_array($v)) { $var[$k]=convert2int($v); } else { $var[$k]=str_replace(',',$v); } }

Re: [PHP] Converting variables to integer

2002-11-06 Thread Kevin Stone
function str2int($str) { $str = str_replace(',', $str); // http://www.php.net/manual/en/function.str-replace.php settype($str, "integer"); // http://www.php.net/manual/en/function.settype.php if (is_int($str)) // http://www.php.net/manual/en/function.is-int.php return $str