How to convert objects into arrays

Question

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

0
, , pandglobal 8 months 0 Answers 99 views 0

Leave an answer