0

Code sample:

$x = collect(["a", "b", "c"]);
$x->toJson(); // => ["a","b","c"]
$x->reverse()->toJson(); // => {"2":"c","1":"b","0":"a"}

As you can see after I reverse the collection, json turns into an object with indexes as keys. How do I prevent that? How to output only values?

Poma
  • 8,174
  • 18
  • 82
  • 144

0 Answers0