Get the number of public properties in the ArrayObject in PHP
Description
The following code shows how to get the number of public properties in the ArrayObject.
Example
<?php//from w w w. j av a2s .c o m
class Example {
public $public = 'public';
private $prv = 'private';
protected $prt = 'protected';
}
$arrayobj = new ArrayObject(new Example());
var_dump($arrayobj->count());
$arrayobj = new ArrayObject(array('first','second','third'));
var_dump($arrayobj->count());
?>
The code above generates the following result.