php loop through all variables in a class code example Example: php iterate thru object foreach ($obj as $key => $value) { echo "$key => $value\n"; }