PHP array length
Get php array length. In this tutorial I will show you how to determine the length and / or the size of a PHP array. You will learn the most important methods how to use PHP functions to get length, size and memory used by the array information.
Tutorial info:
| Name: | PHP array length |
| Total steps: | 1 |
| Category: | Basics |
| Level: | Beginner |
Bookmark PHP array length
Step 1 - Determine PHP array length
PHP array length
As the number of elements can change time to time in your code it is important to get the actual length / size of the array. You have more option to get this information. PHP has 2 built in functions and both returns with the number of element in the array.
The first one is the count() function which counts elements in an array. You can use it like this:
Code:
"grass"=>"green", "sky"=>"blue", "night"=>"black", "wall"=>"white");
Be sure to run the code on a reliable yet cheap web hosting so it won't drill a hole in your pocket.
Tags: php array length, array length, array size, php array size, php, array, length, size
| PHP array length - Table of contents |
|---|
| Step 1 - Determine PHP array length |
