On 05/15/2014 09:26 AM, Ford, Mike wrote:
-----Original Message-----
From: Jim Lucas [mailto:lists@xxxxxxxxx]
Sent: 15 May 2014 16:47
To: php-general@xxxxxxxxxxxxx
Subject: Re: A little confusing thing on (mistakenly) geting a
offset from string with multi dim index.
On 05/14/2014 05:55 PM, Rain Lee wrote:
So, here is the TLDR;
$string = 'this is a string';
In PHP 5.5
isset($string['check']) === false
isset($string['check'][0]) === true
Why can't let
isset($string['check']) === false
isset($string['check'][0]) === false <--
?
I can see WHAT you are doing and WHAT the results are, but I don't
understand
WHY would you ever do this?
You defined $string with a string of characters. But you are trying
to use
$string as an array. This hits me as completely wrong.
That's a perfectly normal PHP idiom to get the nth character of the
string, I do it all over the place - $string[$n] is equivalent to
substr($string, $n, 1);
You are pulling data from a string using a method that is perfectly valid.
He is testing for something. Not the same thing.
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
403a Leslie Silver Building, City Campus, Leeds Metropolitan University,
Woodhouse Lane, LEEDS, LS1 3ES, United Kingdom
E: m.ford@xxxxxxxxxxxxxx T: +44 113 812 4730
From 22 September 2014 Leeds Metropolitan University will become Leeds Beckett University.
Find out more at http://www.leedsbeckett.ac.uk
To view the terms under which this email is distributed, please go to:-
http://www.leedsmet.ac.uk/email-disclaimer.htm
--
Jim Lucas
http://www.cmsws.com/
http://www.cmsws.com/examples/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php