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
>
> :
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
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
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
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
>> 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
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
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
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
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
ses a flag and creates the
warnings.
Such are the joys of loosely typed languages.
Bob McConnell
-Original Message-
From: Andre Polykanine [mailto:an...@oire.org]
Sent: Thursday, April 08, 2010 1:45 PM
To: Shawn McKenzie
Cc: php-general@lists.php.net
Subject: Re: [PHP] No notices for
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?
--
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 19
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
13 matches
Mail list logo