PHP program to display element in array in ascending order

PROGRAM

<?php
$my_array=array('a first element','c seccond element','z third elements','h fourth element');
echo "ASCENTING ORDER";
sort($my_array);
foreach($my_array as $elements)
echo "<br />".$elements;
echo "<br/>";
echo "<br />"."DISCENDINT ORDER";
rsort($my_array);
foreach($my_array as $element)
echo "<br />".$element;
?>

OUTPUT






No comments:

Post a Comment