Array

26


<html>
<head>
<title><b>SORT NUMBERS</b></title>
</head>
<body>
 <form method="post" action="">
 <label for="numbers">Enter numbers separated by commas:</label>
 <input type="text" name="numbers" required>
 <input type="submit" name="sort" value="Sort">
 </form>
 <?php
 if ($_SERVER["REQUEST_METHOD"] == "POST") {
 $numbers = $_POST["numbers"];
 $numberArray = array_map('intval', explode(',', $numbers));
 sort($numberArray);
 echo "<h2>SORTED NUMBERS:</h2>";
 echo implode(",", $numberArray);
 }
 ?>
</body>
</html>