Ask Question

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. 5 June, 14:06
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers