Add the count function (#31336)

This commit is contained in:
Tankica
2018-12-17 06:07:16 +01:00
committed by Randell Dawson
parent 6d9f8593cb
commit 15bfa694cd

View File

@ -127,3 +127,13 @@ When working with arrays, there are a few important things to keep in mind:
2) Named keys must be escaped to be accessed (i.e. $bikes[not my favorite] would not work).
For more information, please see [PHP: Arrays](http://php.net/manual/en/language.types.array.php)
## Length of an Array
The count() function is used to return the length (the number of elements) of an array:
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo count($cars);
?>