PHP | ArrayObject count() Function Last Updated : 27 Sep, 2019 Summarize Comments Improve Suggest changes Share 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 | ArrayObjects::_construct() Function J 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 Like