Tools, FAQ, Tutorials:
Creating an Array in PHP
How To Create an Array in PHP?
✍: FYIcenter.com
You can create an array using the array() constructor. When calling array(), you can also initialize the array with pairs of keys and values. Here is a PHP script on how to use array():
<?php print("Empty array:\n"); $emptyArray = array(); print_r($emptyArray); print("\n"); print("Array with default keys:\n"); $indexedArray = array("PHP", "Perl", "Java"); print_r($indexedArray); print("\n"); print("Array with specified keys:\n"); $mappedArray = array("Zero"=>"PHP", "One"=>"Perl", "Two"=>"Java"); print_r($mappedArray); print("\n"); ?>
This script will print:
Empty array: Array ( ) Array with default keys: Array ( [0] => PHP [1] => Perl [2] => Java ) Array with specified keys: Array ( [Zero] => PHP [One] => Perl [Two] => Java )
⇒ Testing If a Variable Is an Array in PHP
2016-10-15, 1600🔥, 0💬
Popular Posts:
How To Use an Array as a Queue in PHP? A queue is a simple data structure that manages data elements...
How to decode the id_token value received from Google OpenID Connect authentication response? Accord...
Where to find tutorials on Visual Studio? I want to know How to learn Visual Studio. Here is a large...
How to use the JSON to XML Conversion Tool at freeformatter.com? If you want to try the JSON to XML ...
Where can I download the EPUB 2.0 sample book "The Metamorphosis" by Franz Kafka? You can following ...