class { public $a = "3"; public $b = "0"; public $b = "3"; public $c = "0"; public $d = "0"; public $e = "0"; public $g = "0"; }
how can find out properties greater zero?
you can use get_class_vars
function outside object that:
$a = new a(); $class_vars = get_class_vars(get_class($a)); foreach ($class_vars $name => $value) { if ($value > 0) { echo "$name : $value\n"; } }
Comments
Post a Comment