Re: what's "undefined index" ?

From: Date: Mon, 25 Mar 2002 03:43:08 +0000
Subject: Re: what's "undefined index" ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89970@lists.php.net to get a copy of this message
On Monday 25 March 2002 08:35, Martin Towell wrote: > "undefined variable" is when you try to use a variable before you set it, > eg $foobar > "undefined index" is when you try to reference an array index before you > set it, eg $foobar[10] Just to extend the explanation further. The most common cause of undefined index is the use of unquoted array keys: $doo = array('dah' => 'dib'); echo $doo[dah]; # incorrect, undefined index error echo $doo['dah']; # correct, no error -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Life is a game of bridge -- and you've just been finessed. */

« previous php.general (#89970) next »