Answers for "laravel get to array"

PHP
0

convert object to array laravel

$person = new stdClass();
$person->firstName = "Taylor";
$person->age = 32;

//Convert Single-Dimention Object to array
$personArray = (array) $person;

//Convert Multi-Dimentional Object to Array
$personArray = objectToArray($person);
function objectToArray ($object) {
    if(!is_object($object) && !is_array($object)){
    	return $object;
    }
    return array_map('objectToArray', (array) $object);
}
Posted by: Guest on November-03-2019
0

string to array in laravel

$explode_id = json_decode($request->data, true);
Posted by: Guest on October-24-2020
0

return query builder result to array

$result = DB::table('user')->where('name',=,'Jhon')->get();
Posted by: Guest on November-22-2020

Code answers related to "laravel get to array"

Browse Popular Code Answers by Language