DjNaF Posted February 13, 2007 Share Posted February 13, 2007 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 Quote Link to comment Share on other sites More sharing options...
DjNaF Posted February 13, 2007 Author Share Posted February 13, 2007 no suggestion yet? Quote Link to comment Share on other sites More sharing options...
effigy Posted February 13, 2007 Share Posted February 13, 2007 Parentheses are metacharacters in regex; they capture data. If you want a literal paren, you must escape it with a blackslash: \( or \). Quote Link to comment Share on other sites More sharing options...
DjNaF Posted February 13, 2007 Author Share Posted February 13, 2007 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 Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted February 13, 2007 Share Posted February 13, 2007 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]); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.