hehe,

Reading the manual is somewhat not so bad after all...

-- 
-- 
Kim Steinhaug
----------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
----------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.webkitpro.com
----------------------------------------------------------------------


"Robert Cummings" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Thu, 2004-05-13 at 17:27, Kristian Rasmussen wrote:
> > Hi all,
> >
> > I need a script for reversing a string ("hello world" becomes "dlrow
> > olleh"). I have tried the following:
> >
> > ---
> > $length = strlen($i);
> > $g = "";
> >
> > while ($length > 0)
> > {
> >    $g = $i[$length] . $g;
> >   $length--;
> > }
> > echo $g;
>
> The following will work:
>
>     $length = strlen( $i );
>     $g = "";
>
>     while( $length > 0 )
>     {
>         $g .= $i{--$length};
>     }
>     echo $g;
>
> But in all honesty the following is superior:
>
>     $g = strrev( $i );
>     echo $g;
>
> Cheers,
> Rob.
> -- 
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for       |
> | creating re-usable components quickly and easily.          |
> `------------------------------------------------------------'

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

Reply via email to