PHP Multidimensional Arrays


  1. What will be the output of the following PHP code?
    <?php
    $Employee = array("Ajit", "Rahul", "Ats");
    $id = array("001", "002", "003");
    $pro = array_combine($id, $Employee);
    print_r($pro);
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    Here “keys” array is $id and “values” array is $Employee .


  1. What will be the output of the following php code?
    <?php
    $Employee = array("Ajit" => array
    ( "Salary" => "2,40,000", "Designation" => "Software Engineer"),
    "Sumi Sharma" => array( "Salary" => "3,00,000",
    "Designation" => "Software Developer") );
    echo $Employee["Ajit"]["Salary"];
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Treat Employee as a multidimensional array and accordingly traverse it to get the value.