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:
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);
}
}
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
3 matches
Mail list logo