Using the sort () Function
<?php $emp_names []= "D"; $emp_names []= "B"; $emp_names []= "A"; $emp_names []= "C"; $emp_names []= "E"; sort ($emp_names); foreach ($emp_names as $val) { echo "$val", "\n"; } ?>