Get the Number from string using php.Its Simple by PHP to extract numbers from a String. This could be used for several things like extracting data amounts.
 Use php function extract_number() then after use regular expression function ereg_replace() and finally get the output.
Example :
$mytext = "The screen is 900px wide.".
$mytext = extract_number($mytext);
function extract_number($string) {
return ereg_replace("[^0-9]", "", $string);
echo extract_number($mytext);
//output is : 900

No comments:
Post a Comment
Thanks....