Ask Question
18 May, 14:55

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:

+4
Answers (1)
  1. 18 May, 17:36
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers