RE: [PHP] reverse string without strrev();
| From: | Ford, Mike | Date: | Thu, 28 Feb 2008 13:15:01 +0000 |
| Subject: | RE: [PHP] reverse string without strrev(); | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-270553@lists.php.net to get a copy of this message | ||
On 28 February 2008 12:39, Nathan Rixham advised:
> 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.uk
Tel: +44 113 812 4730 Fax: +44 113 812 3211
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm