Parsing javascript arrays in PHP

PatrickG

New Member
I can't seem to figure out how to get a JS array into PHP.What I have to work with looks like this:\[code\]var arrLow = [{"e": "495864","rank": "8678591","rankmove": "<p><img src='http://stackoverflow.com/questions/3886331/up.php?uStyle=144'> UP 495864"},{"e": "104956","rank": "-","rankmove": "<p><img src='http://stackoverflow.com/questions/3886331/up.php?uStyle=145'> DOWN 1"},{"e": "0","rank": "0","rankmove": "<p><img src='http://stackoverflow.com/questions/3886331/up.php?uStyle=975'> NEW"}]\[/code\]json_decode and others just return NULL, google only returns some strange way to use serialize() with a HTTP POST from a JS-understanding browser which really can't work hereDoes anyone have any clue how :x ==========================================================================edit: Thanks guys! Didnt know it was so easy\[code\]<?php $json = file_get_contents('24d29b1c099a719zr8f32ce219489cee.js');$json = str_replace('var arrLow = ','' ,$json);$data = http://stackoverflow.com/questions/3886331/json_decode($json);echo $data[0]->e;?>\[/code\]
 
Back
Top