php - Laravel 5.4 array remove key index -




in controller, statement generates array:

// sort region collection continent faster access in front end $finalregions = $regions->sortby('continent_id');   {      "0":{         "id":1,       "name":"alaska",       "image_x":227,       "image_y":117    },    "1":{         "id":5,       "name":"australian antartic territory",       "image_x":1187,       "image_y":1037 ....    } } 

how remove index resulting object, looks this:

[      {         "id":1,       "name":"alaska",       "image_x":227,       "image_y":117    },    {         "id":5,       "name":"australian antartic territory",       "image_x":1187,       "image_y":1037 ....    } ] 

this stored in field cast json in table class.

$res = []; foreach ($finalregions  $key => $value) {     $res[] = $value; }  // $res contains desired result 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -