I can use intval, but according to the documentation:

Strings will most likely return 0 although this depends on the leftmost characters of the string. The common rules of integer casting apply.

... and the value to parse can be 0, that is I will not able to distinguish between zero and a string.

$value1 = '0';
$value2 = '15';
$value3 = 'foo'; // Should throw an exeption

Real question is: how can I parse the string and distinguish between a string that cast to 0 and a zero itself?

Edit
Report