PHP | ArrayObject count() Function Last Updated : 27 Sep, 2019 Comments Improve Suggest changes Like Article Like Report The ArrayObject::count() function is an inbuilt function in PHP which is used to get the number of public properties in the ArrayObject. Syntax: int ArrayObject::count( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the number of public properties in the ArrayObject. Below programs illustrate the ArrayObject::count() function in PHP: Program 1: php <?php // PHP program to illustrate the // ArrayObject::count() function // Declare an array and convert it // into array object $arrObject = new ArrayObject( array('Geeks', 'for', 'Geeks') ); // Use ArrayObject::count() function // to count the number of public // properties in the ArrayObject $count = $arrObject->count(); print_r($count); ?> Output: 3 Program 2: php <?php // PHP program to illustrate the // ArrayObject::count() function // Declare an associative array $arr = array( "a" => "Welcome", "b" => "to", "c" => "GeeksforGeeks" ); // Create into array object $arrObject = new ArrayObject($arr); // Use ArrayObject::count() function // to count the number of public // properties in the ArrayObject $count = $arrObject->count(); print_r($count); ?> Output: 3 Reference: https://www.php.net/manual/en/arrayobject.count.php Comment More infoAdvertise with us Next Article PHP | ArrayObject count() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ArrayObject Similar Reads PHP | ArrayObjects::_construct() Function The ArrayObjects class allows objects to work as arrays. The ArrayObjects::_construct() is an in built PHP function to construct a new array object. Syntax: public ArrayObject::__construct ($input = array(), int $flags = 0, string $iterator_class = "ArrayIterator") Parameters: This function accepts 2 min read PHP | ArrayIterator count() Function The ArrayIterator::count() function is an inbuilt function in PHP which is used to count the elements of array iterator.Syntax: int ArrayIterator::count( void ) Parameters: This function does not accept any parameters.Return Value: This function returns the number of element present in the array ite 1 min read PHP array_count_values() Function The array_count_values() is an inbuilt function in PHP which is used to count all the values inside an array. In other words we can say that array_count_values() function is used to calculate the frequency of all of the elements of an array. Syntax: array array_count_values( $array ) Parameters: Thi 2 min read PHP | ArrayObject getFlags() Function The ArrayObject::getFlags() function is an inbuilt function in PHP which is used to get the behavior of flags of the ArrayObject. Syntax: int ArrayObject::getFlags( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the behavior flags of the ArrayObj 2 min read ArrayObject exchangeArray() function in PHP The exchangeArray() function of the ArrayObject class in PHP is used to exchange an array from an ArrayObject. That is, it replaces existing array from an ArrayObject with a newly described array. Syntax: ArrayObject exchangeArray( $inputArray ) Parameters: This function accepts a single parameter $ 2 min read PHP ArrayObject setFlags() Function The ArrayObject::setFlags() function is an inbuilt function in PHP that is used to set the flag to change the behavior of the ArrayObject. Syntax: void ArrayObject::setFlags( int $flags ) Parameters: This function accepts single parameter $flags which hold the behavior of new ArrayObject. This param 2 min read PHP count() Function The count() function in PHP is used to count the number of elements in an array or the countable properties of an object. The function returns an integer value representing the number of items present.Syntax:count($array, mode)In this syntax:$array (mandatory): Refers to the array, whose elements ar 3 min read ArrayObject append() function in PHP The append() function of the ArrayObject class in PHP is used to append a given value onto an ArrayObject. The value being appended can be a single value or an array itself. Syntax: void append($value) Parameters: This function accepts a single parameter $value, representing the value to be appended 1 min read PHP array() Function The array() function is an inbuilt function in PHP which is used to create an array. There are three types of array in PHP: Indexed array: The array which contains numeric index. Syntax: array( val1, val2, val3, ... ) Associative array: The array which contains name as keys. Syntax: array( key=>v 2 min read PHP | ArrayObject serialize() Function The ArrayObject::serialize() function is an inbuilt function in PHP which is used to serialize the ArrayObject. Syntax: string ArrayObject::serialize( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the serialized representation of the ArrayObject 1 min read Like