Re: No notices for undefined index

From: Date: Fri, 09 Apr 2010 02:22:06 +0000
Subject: Re: No notices for undefined index
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-303929@lists.php.net to get a copy of this message
>> print $a[0]; // prints 5 >> print $a[100]; // Notice: Uninitialized string offset: 100 Yup, this should happen when 5 is treated as an array of characters. In other words as a string. $a = '5'; echo $a[0]; echo $a[100]; gives you the expected result regarding the original question, i think that the interpreter is prefilling the variable with null $a = 5; var_dump(isset($a[0])); var_dump($a[0]); since $a[0] is already assigned (to null) the interpreter is not throwing a notice $b = null; var_dump(isset($b)); var_dump($b);

« previous php.general (#303929) next »