Converting a String to a Number in PHP


Utilize intval() to convert a numeric string into an integer type.

Source Code

$string = "123";
$number = intval($string);
echo $number; // Outputs: 123
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments