array_values(input); To get all values from an array

array_values();

This function is use to get all values from a defined variable. The concept will be more clear if we look at an example.

<?php
    $val = array("car"=>"BMW","pen"=>"Econo","brand"=>"Dell");
        echo "<pre>";
        print_r(array_values($val));
?>

Here $val variable is an array where stored some values and keys. So now if we just want to print only values on screen. What is the solution ??
Yes...
There is a solution by array_values(); function. If we input the variable in the function we will get the output.
Then only values from the array will get out as output.

Comments

Popular posts from this blog

Git post receive setup at server for git push to the production from local machine

Deploy laravel application to digital ocean droplet