Zend PHP 5.3 Certification Exam


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  • Question 12/31

    The parse_str() function is used to parse a query string just as if it were passed in the URL of a HTTP request. If the second argument is included then the parsed values are written to this variable.

    What is the output of the following script?

    
    <?php
        $str "days=Mon&days=Wed"
             "&fruit[1]=Apple&fruit[]=Banana&age=13";
    
        parse_str($str$output);
    
        // gettype will return 'array' or 'string'
        echo gettype($output['days']);
    
        echo ' - ';
    
        // array_search will return the key
        // where the first argument is located
        echo array_search('Banana'$output['fruit']);
    
        echo ' - ';
    
        echo array_key_exists('age'$output) ? $output['age'] : 0;
    ?>
    
    
    Enter the exact script output