Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count items in stdClass

Status
Not open for further replies.

timgerr

IS-IT--Management
Jan 22, 2004
364
US
If I have this
Code:
 $testing = new stdClass;
 $testing->x1 = 'A';
 $testing->x2 = 'B';
 $testing->x3 = 'B';
How can I find out how many items are in $testing??
Something like count($testing):

thanks,
timgerr

-How important does a person have to be before they are considered assassinated instead of just murdered?
-Need more cow bell!!!

 
Code:
$vars = get_object_vars($testing);
echo "there are ". count($vars) ." properties set for the \$testing object";
 
Thankss

-How important does a person have to be before they are considered assassinated instead of just murdered?
-Need more cow bell!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top