Retrieving Values out of an Array in PHP


How To Retrieve Values out of an Array in PHP?



You can retrieve values out of arrays using the array element expression $array[$key]. Here is a PHP example script:

$languages = array();
$languages["Zero"] = "PHP";
$languages["One"] = "Perl";
$languages["Two"] = "Java";
print("Array with inserted values:\n");

This script will print:

Array with default keys:
The second value: Perl

Array with specified keys:
The third value: Java


Data Types of Array Keys in PHP

Testing If a Variable Is an Array in PHP

Understanding PHP Arrays and Their Basic Operations

⇑⇑ PHP Tutorials

2016-10-15, 1401🔥, 0💬