- var_dump: documentation ( source)
- array_keys: documentation ( source)
- get_object_vars: documentation ( source)
- current: documentation ( source)
<?php
$object = new stdClass();
$object->aaa = 'AAA';
$object->bbb = 'BBB';
$object->ccc = 'CCC';
if( empty( $vars = get_object_vars( $object ) ) === false )
{
$firstKey = current( array_keys( $vars ) );
$get = $object->$firstKey; // To get
unset( $object->$firstKey ); // To remove
var_dump( $get );
}
var_dump( $object );