On April 15, 2004 02:15 pm, Andi Gutmans wrote: > It could be implemented but I don't see the big advantage over $bar ? 0 : > $base It's one character...
Well, currently to check the value and assign the default you need to do the following: $_GET['foo'] = isset($_GET['foo']) ? (int) $_GET['foo'] : 0; Which can get quite annoying if you need to repeat that many times and it's just easier to disable notices and do $_GET['foo'] = (int) $_GET['foo']; I think if anyone of the following would work it would be quite convenient isset_or_default($_GET['foo'], 0); /* if $_GET['foo'] is set leave as is, otherwise assign 0 to it */ $_GET['foo'] = isset_or_default($_GET['foo'], 0); /* same as above, but the variable is not passed by reference */ isset($_GET['foo']) ? : 0; /* Sascha's proposal */ Ilia -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php