php - Access variable of stdClass Object -
i using laravel select statement select row highest id this:
$user_id = db::connection('mysql2')->select('select max(id) users')[0]; this returns array object looks this:
stdclass object ( [max(id)] => 11 ) 1 i have tried $object->max(id) , $object['max(id)'] not seem work.
dynamic attributes not allowed characters can accessed using curly brackets this:
$object->{"max(id)"}
Comments
Post a Comment