Re: A little confusing thing on (mistakenly) geting a offset from string with multi dim index.
| From: | Jim Lucas | Date: | Thu, 15 May 2014 16:45:29 +0000 |
| Subject: | Re: A little confusing thing on (mistakenly) geting a offset from string with multi dim index. | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323333@lists.php.net to get a copy of this message | ||
On 05/15/2014 09:26 AM, Ford, Mike wrote:
You are pulling data from a string using a method that is perfectly valid. He is testing for something. Not the same thing.-----Original Message----- From: Jim Lucas [mailto:lists@cmsws.com] Sent: 15 May 2014 16:47 To: php-general@lists.php.net Subject: Re: [PHP] 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: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);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.
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-- Jim Lucas http://www.cmsws.com/ http://www.cmsws.com/examples/E: m.ford@leedsmet.ac.uk T: +44 113 812 4730From 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