Ask Question
18 November, 14:23

Suppose an array of country codes and country names is created with a statement like this: $country_codes = array ('DEU' = > 'Germany', 'JPN' = > 'Japan', 'ARG' = > 'Argentina', 'USA' = > 'United States'); If you want to use echo statements to display a table of all of the codes and names, you could code those statements within a loop that starts like this:

+1
Answers (1)
  1. 18 November, 17:17
    0
    Following are the code in the PHP Programming Language:

    foreach ($country_codes as $code = > $name) {

    Explanation:

    The following option is true because the Foreach statement only works on the objects and array and this statement is good for accessing the key and value pairs from the array.

    So, that's why to print following associative array through echo statement we use the Foreach loop statement with following right condition.

    syntax:

    foreach (array as value)

    {

    code or body to execute;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose an array of country codes and country names is created with a statement like this: $country_codes = array ('DEU' = > 'Germany', ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers