RE: [PHP] If the first four characters are "0000", then do {}
| From: | Ford, Mike | Date: | Wed, 27 Jan 2010 13:03:25 +0000 |
| Subject: | RE: [PHP] If the first four characters are "0000", then do {} | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-301544@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Daevid Vincent [mailto:daevid@daevid.com]
> Sent: 26 January 2010 03:52
>
> if (substr($mydata->restored,0,4) == "0000") { }
>
> Or in your very specific case you could do the harder way and note
> that
> strings work like simple arrays too in a way, so $mydata-
> >restored{0}
> through $mydata->restored{3} should all be '0' ( note the {} and not
> [] ).
Sorry, this is out of date and wrong. [] is the currently recommended way to do string indexing, and
{} is deprecated. See the Note at http://php.net/manual/en/language.types.string.php#language.types.string.substr.
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507, Civic Quarter Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm