Find the last array from multidimensional array in PHP

Today I am going of discuss the following topic:-

Find the last array from multidimensional array in PHP:-

Take multidimensional Array in PHP:-


    $arr[] = array(
        "name" => "John 1",
        "email" => "john1@gmail.com",
    );
    $arr[] = array(
        "name" => "John 2",
        "email" => "john2@gmail.com",
    );
    $arr[] = array(
        "name" => "John 3",
        "email" => "john3@gmail.com",
    );
    $arr[] = array(
        "name" => "John 4",
        "email" => "john4@gmail.com",
    );
    $arr[] = array(
        "name" => "John 5",
        "email" => "john5@gmail.com",
    );
    $arr[] = array(
        "name" => "John 6",
        "email" => "john6@gmail.com",
    );

    echo "<pre>";
    print_r($arr);
    echo "</pre>";

Output of this array is show in below screenshot:-



Then write following command:-


                echo "<pre>";
                print_r(end($arr));
                echo "</pre>";
                

and it's output will be:-



If you have any doubt in PHP, please let me know, I'll try my best solve your problem.
Please share your valuable feedback.

Thanks.

Comments

Post a Comment

Please give your valuable feedback!

Popular posts from this blog

เคฏाเคฐी เคœเคฆो เคฆी เคซเค•ीเคฐा เคคेเคฐे เคจाเคฒ เคฒाเค‡ เค† - Most Inspirational Shabad

Feelings of Girls Related to their life

If MySql Stopped Working Unexpectedly in XAMPP Local Server