get int php 01 code example Example 1: php string to int intval($string); Example 2: string to int php $str = "10"; $num = (int)$str;