- array_reverse: documentation ( source)
- explode: documentation ( source)
- trim: documentation ( source)
<?php
$s = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
$s = explode(" ", $s);
foreach($s as $o => $x)
$s[$o] = trim($x);
$s = array_reverse($s);
foreach($s as $l)
echo $l . "\n";