Sort check
- Write a function
isSorted($numbers) that checks whether the array $numbers
is sorted (return true;) or not (return false;)
- Make a (two-dimensional) array
$rows, each element of which is an array of
numbers
$rows[0] = [3, 7, 10, 19, 25];
$rows[1] = [3, 7, 30, 19, 25];
$rows[2] = [3, 7, 10, 19, 17];
- Call the function
isSorted() on these number arrays, and give some feedback to the user
in the following form
- 3, 7, 10, 19, 25 => sorted
- 3, 7, 30, 19, 25 => NOT sorted
- 3, 7, 10, 19, 17 => NOT sorted
Tip
Use the PHP function implode() to convert an array (of numbers) into a string (with the numbers
separated by commas)