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
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
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,
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
:)
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);
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
: 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
: 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
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
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
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
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
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
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
14 matches
Mail list logo