Re: reverse string without strrev();

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

 



Shelley wrote:
Hi all,

What do you think is the best way to display string 'abcdef' as 'fedcba'?


$tmp = '';
$str = 'abcdef';

for ($i = strlen($str); $i >= 0; $i--) {

  $tmp.= $str[$i];
}

echo $tmp;


--
Aschwin Wesselius

<social>

What you would like to be done to you, do that to the other....

</social>

--
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