array_values()
functionYou can use the PHP array_values()
function to get all the values of an associative array.
Let's try out an example to understand how this function works:
<?php
$cities = array("France"=>"Paris", "India"=>"Mumbai", "UK"=>"London", "USA"=>"New York");
// Get values from cities array
print_r(array_values($cities));
?>
You can also use the PHP foreach
loop to find or display all the values, like this:
<?php
$cities = array("France"=>"Paris", "India"=>"Mumbai", "UK"=>"London", "USA"=>"New York");
// Loop through cities array
foreach($cities as $key => $value){
echo $key . " : " . $value . "<br>";
}
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to find IP address on Ubuntu
Want to know what is your Ubuntu desktop...How to Install Latest Version of Nodejs in Ubuntu
Node js is one of the most popular progr...How to Update the Node Version in Ubuntu
In this article i will share with you ho...How to Make a User an Administrator in Ubuntu
While your computer is shared with your...How to Abort Ajax Requests using jQuery
Sometimes you might want to cancel the a...