<html>
<head>
<title>Remove array elements</title>
</head>
<body>
<ol>
<?php
$arr = array( "Orange", "Cherry", "Apple", "Banana", "Lemon" );
$first = array_shift( $arr );
$last = array_pop( $arr );
sort( $arr );
foreach( $arr as $value){ echo("$value, ");}
echo("<br>Removed first element: $first");
echo("<br>Removed last element: $last");
?>
</ol>
</body>
</html>
|