[nycphp-talk] PHP version compatibility standards
sigurdp at i2ssoftware.com
sigurdp at i2ssoftware.com
Tue Dec 17 07:43:16 EST 2002
I was also shocked by the many differences between versions in PHP. Why no
key_exists? ... I found this in the change log:
In 4.0.6 David Croft: Added key_exists() to check if a given key or index
exists in an array or object.
In 4.2.0 Derick: Renamed key_exists() to array_key_exists().
I dont know how the policy is on renaming between versions like that rather
than depricating. Sometimes language developers will preserve the right to
change code interfaces so long as it is within major version releases but
that can not be the case now because an uprade from 4.0 to 4.2 looks like a
major one to me.
Rgds,
Sigurdur
----- Original Message -----
From: "Emmanuel. M. Decarie" <emm at scriptdigital.com>
To: "NYPHP Talk" <talk at nyphp.org>
Sent: Monday, December 16, 2002 9:48 AM
Subject: Re: [nycphp-talk] PHP version compatibility standards
> 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/>
>
>
>
> --- Unsubscribe at http://nyphp.org/list/ ---
>
>
>
More information about the talk
mailing list