How to get single value from array in php?
In PHP, if you want to access a single value from an array, be it a numeric, indexed, multidimensional or associative array, you need to use the array index or key.
Here’s an example using a multidimensional array:
BY Best Interview Question ON 07 Apr 2020
Example
$superheroes = array(
array(
"name" => "Name",
"character" => "BestInterviewQuestion",
),
array(
"name" => "Class",
"character" => "MCA",
),
array(
"name" => "ROLL",
"character" => "32",
)
);
echo $superheroes[1]["name"];
Output:
CLASS