home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book HomePHP CookbookSearch this book

1.5. Reversing a String by Word or Character

1.5.3. Discussion

Reversing a string by words can also be done all in one line:

$reversed_s = join(' ',array_reverse(explode(' ',$s)));

1.5.4. See Also

Recipe 18.8 discusses the implications of using something other than a space character as your word boundary; documentation on strrev( ) at http://www.php.net/strrev and array_reverse( ) at http://www.php.net/array-reverse.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.











??????????????@Mail.ru