php get int from string code example
Example 1: php get only numbers from string
$str = 'In My Cart : 11 items';
$int = (int) filter_var($str, FILTER_SANITIZE_NUMBER_INT);
Example 2: convert to int php
$myintvariable = intval($myvariable);
Example 3: convert string to int php
intval ( mixed $var [, int $base = 10 ] ) : int