How to Get Specific Key Value in PHP Array?

03-Apr-2023

.

Admin

How to Get Specific Key Value in PHP Array?

Hi Dev,

In this tutorial, I will show you how to get specific key values in a PHP array. you'll learn how to get values from the specific keys in the array. Here you will learn how to find values by specific keys in a PHP array. you will learn how to find specific key values in the array. you will do the following things how to get only values from the specific key in an array in PHP.

Today, I will let you know an example of how to get specific key values in a PHP array. We will look at examples of how to get values from the specific keys in the array. you will learn how to find values by specific keys in a PHP array. This tutorial will give you a simple example of how to find specific key values in the array.

Example:


index.php

<?php

$array = array('UK'=>'London','India'=>'Delhi','Japan'=>'Tokyo');

$key = $array['UK'];

echo "An item by key 'UK': {$key}\n";

?>

Output:

An item by key 'UK': London

I hope it could help you...

#PHP