menu

Questions & Answers

Convert js objects to php array

how to convert js object to php array

[{"name":"bill","age":43,"count":5},{"name":"john","age":32,"count":1},{"name":"andy","age":25,"count":1}]

to

[ [ "name" => "bill", "age" => 43, "count" => 5 ], [ "name" => "john", "age" => 32, "count" => 1 ], [ "name" => "andy", "age" => 25, "count" => 1 ] ];
Comments:
2023-01-07 20:32:58
Your question doesn't make sense. The output you desire isn't valid JavaScript. It's the PHP syntax to create the equivalent data structure to the one you already have … if you were working in PHP … which you're not.
2023-01-07 20:32:58
JavaScript is not interoperable with PHP.
Answers(0) :