RE: If the first four characters are "0000", then do {}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Daevid Vincent [mailto:daevid@xxxxxxxxxx]
> 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@xxxxxxxxxxxxxx 
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux