str_replace():-
The str_replace() function replaces some characters with some other characters in a string.
is_numeric():-
The is_numeric() function checks whether a variable is a number or a numeric string.
code:-
<?php
$str = "120,10";
$num = str_replace( ',', ' ', $str);
if( is_numeric($num))
{
echo $num."\n";
}
?>
$str = "120,10";
$num = str_replace( ',', ' ', $str);
if( is_numeric($num))
{
echo $num."\n";
}
?>
output:-
12010
Post a Comment
If you have any doubts, Please let me know
Thanks!