[nycphp-talk] PHP version compatibility standards
Emmanuel. M. Decarie
emm at scriptdigital.com
Mon Dec 16 09:40:46 EST 2002
What could be the best practice, best defensive programming regarding
this situation when you write your own programs? Anyone have
suggestions or pointers.
I started this September with PHP and I was really bitten by the
differences in version between 4.0.6/4.1.2
For example I had to write/install a PHP module for a client running
unfortunately 4.0.6 while I was developing on my staging server on
4.1.2. I fall in all the traps regarding the differences in scope
with $HTTP_GET_VARS and $_GET. That's ok, I was beginning to learn
the language.
But I find quite astonishing that key_exists() doesn't work anymore
on 4.1.2 (you have to use instead array_key_exists
<http://www.php.net/manual/en/function.array-key-exists.php>). So I
had to write a wrapper for this functionality.
function keyexists ($key, $array) {
$keyexists;
if ( function_exists ( "key_exists" ) ) {
$keyexists = key_exists;
} else {
$keyexists = array_key_exists;
}
if ( $keyexists ( $key, $array ) ) {
return true ;
} else {
return false;
}
}
Why in the world key_exists was not aliased to array_key_exists and
flagged as deprecated in 4.1.2?
Cheers
-Emmanuel
--
______________________________________________________________________
Emmanuel Décarie / Programmation pour le Web - Programming for the Web
Frontier - Perl - PHP - Javascript - XML <http://scriptdigital.com/>
More information about the talk
mailing list