Special loop for sorting arrays
Example:
$users = [1 => "Billy", 2 => "Max", 3 => "Brianna", 5 => "Stiven"]; foreach($users as $user)//specify which array to iterate and a variable to which one element of the array will be passed { echo "$user"; }
The foreach loop allows you to extract not only values, but also element keys:
$users = [1 => "Billy", 2 => "Max", 3 => "Brianna", 5 => "Stiven"]; foreach($users as $key => $value) { echo "$key - $value"; } ?>