I want to generate a selectbox using two arrays, one containing the country codes and another containing the country names.
This is an example:
array_map seems good for this too
$codes = array('tn','us','fr');
$names = array('Tunisia','United States','France');
array_map(function ($code, $name) {
echo '';
}, $codes, $names);
Other benefits are:
If one array is shorter than the other, the callback receive null values to fill in the gap.
You can use more than 2 arrays to iterate through.