PHP Strings – Convert string to integer

In this post we will be creating a PHP script that will convert a string to an integer type. To do this we will be casting the string in to a numeric integer type. See the snippet of code for how this is done.

$num = "323215";
$int = (int)$num;
echo $int;

Leave a Reply