array_filter problem with 0's
| From: | Chris | Date: | Wed, 23 Jul 2008 09:01:46 +0000 |
| Subject: | array_filter problem with 0's | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-45156@lists.php.net to get a copy of this message | ||
I have a string
$num = "012 4290-2008";
I made it an array with
I tried to get the integers from the string like this.
$value = str_split($num);
$value_new = array_filter($value, "return_int");
function return_int($value){
if(ctype_digit($value)){
echo $value;
return $value;
}
}
The echo prints out all the digits including the 0.
But the $value_new are missing the 0's.
I would appreciate it if some one can point me in the right direction
Thanks in advance
Chris