With this test page:
$page = (int) $_GET['page'] ?: '1';
echo $page;
I don't understand the output I'm getting when page is undefined:
Request Result
?page=2 2
?page=3 3
?page= 1
? error: Undefined index page
Why the error message? It's PHP 5.3; why doesn't it echo "1"?
1
, not'1'
. – ThiefMasterphp -r 'echo (int)$foo ?: 1;'
(PHP 5.3.3, notice the lack of error due to error reporting being silent). Can you try to run that and see what it does? Does it really say "error, undefined index"? – deceze♦