note 55747 modified in function.isset by googleguy

From: Date: Sat, 19 Jan 2013 03:53:36 +0000
Subject: note 55747 modified in function.isset by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-193264@lists.php.net to get a copy of this message
In PHP4, the following works as expected: <?php if (isset($obj->thing['key'])) { unset($obj->thing['key']) ; } ?> In PHP5 however you will get a fatal error for the unset(). The work around is: <?php if (is_array($obj->thing) && isset($obj->thing['key'])) { unset($obj->thing['key']) ; } ?> --was-- In PHP4, the following works as expected: if (isset($obj->thing['key'])) { unset($obj->thing['key']) ; } In PHP5 however you will get a fatal error for the unset(). The work around is: if (is_array($obj->thing) && isset($obj->thing['key'])) { unset($obj->thing['key']) ; } http://php.net/manual/en/function.isset.php

« previous php.notes (#193264) next »