Concisely reversing a string by word : array_reverse « Data Structure « PHP






Concisely reversing a string by word

 
<?php
$reversed_s = implode(' ',array_reverse(explode(' ',$s)));
?>
  
  








Related examples in the same category

1.Return an array with elements in reverse order
2.Reversing an Array Using array_reverse()
3.array_reverse() function reverses the order of the array elements.
4.Reversing a string by word