Re: reverse string without strrev();
| From: | Nathan Rixham | Date: | Thu, 28 Feb 2008 14:07:15 +0000 |
| Subject: | Re: reverse string without strrev(); | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270558@lists.php.net to get a copy of this message | ||
Ford, Mike wrote:
On 28 February 2008 12:39, Nathan Rixham advised:cheers for the heads up on curlies Mike :)should it not use curlies?No, they will be deprecated as of PHP6. (Square brackets used to be, but have been undeprecated and are back in favour!)$tmp = ''; $str = 'abcdef'; for ($i = strlen($str)-1; $i >= 0; $i--) { $tmp.= $str{$i}; } echo $tmp;Cheers! -- Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.ukTel: +44 113 812 4730 Fax: +44 113 812 3211To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm