How to convert objects into arrays


Please i need assistance in converting objects that is returned from $wpdb->get_results into arrays so that i can call them values like $query[‘username’] instead of using $Query->username

because my method of doing it is not flexible enough and it makes me write many codes by manually creating those column as array just like this code below
$data = array('username = $query->username, email = $query->email');
but i believe there is a simple way to do this automatically without having to retype all column names one by one

, , pandglobal 3 years 2020-06-03T04:10:56-05:00 0 Answers 99 views 0

Leave an answer