English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP sizeof() Function Usage and Example
Syntax
Definition and usage
Calculate the number of elements in the array or properties in the object.1If the optional mode parameter is set to COUNT_RECURSIVE (or
Serial number | Parameters and descriptions |
---|---|
1 | array Required. Specify an array |
2 | mode Optional. Specify the function mode. |
Return the number of elements in the array.
<?php $a[0] = 1; $a[1] = 3; $a[2] = 5; $result = sizeof($a); print($result); ?>Test and see‹/›
Output result:
3