➤ Using 
intval()
 function.
• To convert string to integer using PHP built-in function, intval(), 
provide the string as argument to the function. The function will 
return the integer value corresponding to the string content.
$number_str = "10";
$int_number = intval($number_str);
echo gettype($int_number); // outputs:  integer
➤ Using explicit Casting.
• To convert string to integer using Type Casting, provide the 
literal (int) along with parenthesis before the string literal. 
The expression returns integer value of the string.
$str = 10;
$number = (int)$str;
echo gettype($number); // outputs:  integer