mejora

mejora

am 23.07.2008 17:04:31 von bermu

Cris:
Hi.
The improvement to your function, proposed by Sanjay Mantoor, works
excellent. There´s no need to find any other way.

Bermúdez.

//here we use the function you proposed, improved by Sanjay Mantoor:
function return_int($value){
if (ctype_digit($value))
{
echo $value."\t";
return true;
}
else
{
return false;
}
}
?>

//First, we get the string from the a form:
$num=$_POST['the_string'];

//now we construct an array with characters in the string:
$value = str_split($num);

//here we filter the array looking for........ you know:
$value_new = array_filter($value, "return_int");

//This programming exercise comes from an eMail I recived yerterday.


//How can I find the integers inside a string?

//The original an a good answer are in the folder of the site. Read
it!
//Wednesday, july 23th, 2008.
?>







--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php