Is here any way to parse JavaScript syntax in PHP?
I want to get all JS variables in PHP array
$string = 'var variable = "hello";
var thisIsVariableToo = "world";
var and = ["this", "is"];
var its = new Array("amazing");
var nice = null;';
I want to get in PHP from that (^^^) string:
$string = [
"variable" => "hello",
"thisIsVariableToo" => "world",
"and" => ["this", "is"],
"its" => ["amazing"],
"nice" => null
]
How I can do that?