PHP | ArrayObject count() Function
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
$arrObject = new ArrayObject(
array ( 'Geeks' , 'for' , 'Geeks' )
);
$count = $arrObject -> count ();
print_r( $count );
?>
|
Program 2:
<?php
$arr = array (
"a" => "Welcome" ,
"b" => "to" ,
"c" => "GeeksforGeeks"
);
$arrObject = new ArrayObject( $arr );
$count = $arrObject -> count ();
print_r( $count );
?>
|
Reference: https://www.php.net/manual/en/arrayobject.count.php
Last Updated :
27 Sep, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...