Preg_Split Issues

Hi,
I have data as below

// [ { "id": "4674509" ,"t" : "RELIANCE" ,"e" : "NSE" ,"l" : "889.40" ,"l_fix" : "889.40" ,"l_cur" : "Rs.889.40" ,"s": "0" ,"ltt":"12:44PM GMT+5:30" ,"lt" : "Mar 22, 12:44PM GMT+5:30" ,"c" : "+3.60" ,"c_fix" : "3.60" ,"cp" : "0.41" ,"cp_fix" : "0.41" ,"ccol" : "chg" ,"pcls_fix" : "885.8" } ] 

in a variable and want to split it with

" ,"

My code doesn’t return the individual array values

$grab_data = file_get_contents_curl(“kkonline.org/data.php”);

$matches = preg_split(‘" ,"’, $grab_data);
echo $matches[0];

Now here $matches[0]; returns the complete data not the splitted values

Any idea what is wrong?

syntax error, unexpected ‘:’ in …

Not sure of an answer just yet.

This might be due to the way I copied the data. Turn error reporting on.

It works fine if the string is quoted.

$grab_data = '"id": "4674509" ,"t" : "RELIANCE" ,"e" : "NSE" ,"l" : "889.40" ,"l_fix" : "889.40" ,"l_cur" : "Rs.889.40" ,"s": "0" ,"ltt":"12:44PM GMT+5:30" ,"lt" : "Mar 22, 12:44PM GMT+5:30" ,"c" : "+3.60" ,"c_fix" : "3.60" ,"cp" : "0.41" ,"cp_fix" : "0.41" ,"ccol" : "chg" ,"pcls_fix" : "885.8"';

Well, simple answer is, dont preg_split this.

It’s in JSONotation (Except for the initial/end square brackets and comment slashes). So use json_decode to pull it down into an object you can access.