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 you the

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' evaluates

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,

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 :)

[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);

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 12

Re: [PHP] No notices for undefined index

2010-04-08 Thread Andre Polykanine
: 191749952 Twitter: m_elensule - Original message - From: Shawn McKenzie nos...@mckenzies.net To: php-general@lists.php.net 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

RE: [PHP] No notices for undefined index

2010-04-08 Thread Bob McConnell
: 191749952 Twitter: m_elensule - Original message - From: Shawn McKenzie nos...@mckenzies.net To: php-general@lists.php.net 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

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 General

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 are

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' evaluates

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 like an

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 that

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 nos...@mckenzies.net wrote: So the