Re: [PHP] No notices for undefined index

2010-04-09 Thread Ashley Sheridan
On Fri, 2010-04-09 at 14:15 +0100, Nathan Rixham wrote: > Ashley Sheridan wrote: > > can't find anything in the manual that explains what should happen when > > you treat a string like an array in PHP. > > http://www.php.net/manual/en/language.types.string.php#language.types.string.substr > > :

Re: [PHP] No notices for undefined index

2010-04-09 Thread Nathan Rixham
Ashley Sheridan wrote: > can't find anything in the manual that explains what should happen when > you treat a string like an array in PHP. http://www.php.net/manual/en/language.types.string.php#language.types.string.substr :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, v

RE: [PHP] No notices for undefined index

2010-04-09 Thread Bob McConnell
From: Shawn McKenzie > Bob McConnell wrote: >> In the first case, $a=5 creates a multi-typed variable. The interpreter >> makes its best guess how the next two expressions should be interpreted. >> In both cases, they look a lot like an index into a character array >> (string), and 'test' evaluate

Re: [PHP] No notices for undefined index

2010-04-09 Thread Ashley Sheridan
On Fri, 2010-04-09 at 07:52 +0530, kranthi wrote: > >> 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

Re: [PHP] No notices for undefined index

2010-04-08 Thread shiplu
Hello Shawn, Why dont you report a bug? When we know the expected behavior or the way it SHOULD behave. and its not behaving that way. Its certainly a bug.. Only then we can know the real reason why the novicas are not showing up. On 4/8/10, Shawn McKenzie wrote: > So the first two print statemen

Re: [PHP] No notices for undefined index

2010-04-08 Thread kranthi
>> 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 t

Re: [PHP] No notices for undefined index

2010-04-08 Thread Ashley Sheridan
On Thu, 2010-04-08 at 15:22 -0500, Shawn McKenzie wrote: > Shawn McKenzie wrote: > > Bob McConnell wrote: > >> In the first case, $a=5 creates a multi-typed variable. The interpreter > >> makes its best guess how the next two expressions should be interpreted. > >> In both cases, they look a lot l

Re: [PHP] No notices for undefined index

2010-04-08 Thread Shawn McKenzie
Shawn McKenzie wrote: > Bob McConnell wrote: >> In the first case, $a=5 creates a multi-typed variable. The interpreter >> makes its best guess how the next two expressions should be interpreted. >> In both cases, they look a lot like an index into a character array >> (string), and 'test' evaluate

Re: [PHP] No notices for undefined index

2010-04-08 Thread Shawn McKenzie
Bob McConnell wrote: > In the first case, $a=5 creates a multi-typed variable. The interpreter > makes its best guess how the next two expressions should be interpreted. > In both cases, they look a lot like an index into a character array > (string), and 'test' evaluates numerically to zero. Both

Re: [PHP] No notices for undefined index

2010-04-08 Thread Shawn McKenzie
Andre Polykanine wrote: > Hello Shawn, > > Hm... isn't it expected behavior? Since you haven't defined a > $a['test'] item, PHP throws a notice... or I'm wrong? Yes it is expected. I'm saying the opposite that it doesn't in the first case. -- Thanks! -Shawn http://www.spidean.com -- PHP Gene

RE: [PHP] No notices for undefined index

2010-04-08 Thread Bob McConnell
Yahoo! messenger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Shawn McKenzie To: php-general@lists.php.net Date: Thursday, April 8, 2010, 8:36:21 PM Subject: [PHP] No notices for undefined index So the first two print statements generate NO notice

Re: [PHP] No notices for undefined index

2010-04-08 Thread Andre Polykanine
senger: andre.polykanine; ICQ: 191749952 Twitter: m_elensule - Original message - From: Shawn McKenzie To: php-general@lists.php.net Date: Thursday, April 8, 2010, 8:36:21 PM Subject: [PHP] No notices for undefined index So the first two print statements generate NO notices, while t

Re: [PHP] No notices for undefined index

2010-04-08 Thread Ashley Sheridan
On Thu, 2010-04-08 at 12:36 -0500, Shawn McKenzie wrote: > So the first two print statements generate NO notices, while the second > obviously generates: > > Notice: Undefined offset: 1 in /home/shawn/www/test.php on line 11 > > Notice: Undefined index: test in /home/shawn/www/test.php on line

[PHP] No notices for undefined index

2010-04-08 Thread Shawn McKenzie
So the first two print statements generate NO notices, while the second obviously generates: Notice: Undefined offset: 1 in /home/shawn/www/test.php on line 11 Notice: Undefined index: test in /home/shawn/www/test.php on line 12 This sucks. A bug??? error_reporting(E_ALL); ini_set('display_e