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
Share on other sites

its still returning this

 

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

 

i used this code!

 

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

echo strip_tags($result[0]);

 

i need a solution to return the 3 arrays,

 

and save them into new 3 php arrays

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.