PHP Array functions.
A (hopefully useful) list of some array functions, what they do, and an example usage.
|array()||Creates arrays and hashes.||$desserts = array("chocolate", "icecream");|
$appliances = array("fridge" => "Kelvinator", "toaster" => "Sunbeam");
|sizeof()||Returns the number of array elements.||sizeof($desserts); |
// Returns 2 in this case.
|is_array()||Test if a variable is an array.||is_array($desserts); |
// Returns true, since $desserts is an array.
|range()||Automatically create an array containing a range of elements||$letters = range("b", "f");|
// Returns: ("b", "c", "d", "e", "f")
|array_values()||Returns an array of a hashes values.||$values = array_values($hash-array);|
|array_keys()||Returns an array of a hashes keys.||$keys = array_keys($hash-array);|
|array_search()||Find value in array, returns key or list number.||array_search("lookfor", $in);|
|in_array()||Returns true or false if an array contains a specific value.||in_array("lookfor", $in);|
|extract()||Extracts list items into matched variable/value pairs.||extract($deserts); |
// Returns variabes named as the hash keys.
|list()||Assigns list values to variables.||list($a, $b) = $desserts;|
This site is totally free to use, you have absolutely no moral or legal obligations to help us continue.
There are however, some costs involved in running the site.
So if this site helped you find your way,
perhaps you could consider contributing to our costs.
Whatever amount you feel this site was worth to you would be just wonderful.
Use PayPal if you do decide to share and help us with the costs and in appreciation for our time and attention, or alternatively buy a book from our Bookstore..
Time in Don's part of the world is: Sat, October 20, 2018 at 07:33 AM
Time in Franki's part of the world is: Saturday, October 20, 2018 at 8:33 PM
Don't worry neither one sleeps very long!