Is there any difference between int and integer in PHP?
Which is the newer or more recommended use?
$a = (int)\"3 euros\";
This is not quite true, there is actually a difference between int and integer. Here a simple example:
//print_r('PHP version: '.phpversion().'
');
//PHP version: 5.5.23
$i = '1';
function testme(int $j){
print_r ($j);
}
testme(intval($i));
This little portion of code will print an "E_RECOVERABLE_ERROR" since testme function is expecting 'int' and get 'integer' instead.