Jump to content

parsing data


DjNaF

Recommended Posts

i am reading a txt fiel from the internet using fread

 

i get this data from the file

 

var tickerDate="13 February 2007";

document.all.indexDiv.innerHTML = "<strong><span id=r class=i>Market Closed</span>";

 

var _s = new Array("AAAA","BBBB","CCCC","DDDD","EEEE","FFFF");

var _p = new Array("1.44","5.33","44.4","22.33","123.1","33.4");

var _y = new Array("+","0","-","-","+","0");

 

updateTicker();

if(tickerTime) window.clearTimeout(tickerTime);

 

i am trying to parse the 3 arrays into 3 php arrays!

can anyone help in that.

 

i tried preg_match('/new Array(.*);/i', $data, $result);

not working fine

 

thank you all

Link to comment
https://forums.phpfreaks.com/topic/38329-parsing-data/
Share on other sites

You're including the word 'new' in your regexp so it's going to be returned in $result.

 

Try this, going from memory so might need some adjustment:

preg_match('/Array\(.*\);/i', $data, $result);

 

Or this:

preg_match('/new (Array\(.*\);)/i', $data, $result);
echo($result[1]);

Link to comment
https://forums.phpfreaks.com/topic/38329-parsing-data/#findComment-183784
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.