What type of this array?

hi, this array is coming from an url… what type of this array, how can i use and record to mysql db?


{w:[['11070','070. Hafta','1'],['11069','069. Hafta','0'],['11068','068. Hafta','0'],['11067','067. Hafta','0'],['11066','066. Hafta','0'],['11065','065. Hafta','0'],['11064','064. Hafta','0'],['11063','063. Hafta','0'],['11062','062. Hafta','0'],['11061','061. Hafta','0']], d:[['-1','Hepsi',''],['30.08.2011','30.08.2011 Sal','0'],['31.08.2011','31.08.2011 Çar','1'],['01.09.2011','01.09.2011 Per','0']], l:[['-1','Hepsi',''],['83','Brezilya-Serie A','0'],['754','Brezilya-Serie B','0'],['1225','Copa Sudamericana-2.Tur','0'],['606','Finlandiya-Ykkonen','0'],['121','Fransa-Lig Kupası','0'],['447','İrlanda-FAI Kupası','0'],['16','İtalya-Serie B','0']]}

To be Simple

[w]=array();

First explode by :[

then explode the second element by [

then explode by , and remove the element of value ]

Hi,

this looks like a json response to me.

Try




CJSON::decode("{w:[['11070','070. Hafta','1'],['11069','069. Hafta','0'],['11068','068. Hafta','0'],['11067','067. Hafta','0'],['11066','066. Hafta','0'],['11065','065. Hafta','0'],['11064','064. Hafta','0'],['11063','063. Hafta','0'],['11062','062. Hafta','0'],['11061','061. Hafta','0']], d:[['-1','Hepsi',''],['30.08.2011','30.08.2011 Sal','0'],['31.08.2011','31.08.2011 Çar','1'],['01.09.2011','01.09.2011 Per','0']], l:[['-1','Hepsi',''],['83','Brezilya-Serie A','0'],['754','Brezilya-Serie B','0'],['1225','Copa Sudamericana-2.Tur','0'],['606','Finlandiya-Ykkonen','0'],['121','Fransa-Lig Kupası','0'],['447','İrlanda-FAI Kupası','0'],['16','İtalya-Serie B','0']]}");



But this works for me (returns an array) only when I comment out json_decode check




	public static function decode($str, $useArray=true)

	{

//		if(function_exists('json_decode'))

//			return json_decode($str,$useArray);



otherwise it returns null. Looks like json_decode is a little bit buggy?

i couldnt fix it yet…

See the language syntax here

Example




$obj = CJSON::decode(

  '{"w":[

    ["11070","070. Hafta","1"],

    ["11069","069. Hafta","0"]

  ]}'

);



/Tommy

Thank you Tommy…

its now running…




$url = file_get_contents("myurl");	

	

	$trans_array = array();

	$trans_array["w:"] = '"w":';

	$trans_array["d:"] = '"d":';

	$trans_array["l:"] = '"l":';

	$trans_array["'"] = '"';

	

	$url = strtr($url,$trans_array);

	$url = CJSON::decode($url);


	echo "<pre>";

	print_r($url);