php - Looping trough multidimensional array to get specific results from sub arrays -
i have array , extract data out of array. no problem me time little bit different me.
i have array:
$arrparcellabelnumber = array ( "parcellabelnumber" => array ( 0 => "10", 1 => "20" ), "weight" => array ( 0 => "1111", 1 => "2222" ) );
i have following result: 10 = 1111, 20 = 2222
so means want value of parcellabelnumber key same 1 weight , want value of weight both same.
i tried several methods of them didn't work.
new code:
$arrparcellabelnumber = array ( "parcellabelnumber" => array ( 0 => "09988014801055", 1 => "09988014801056" ), "weight" => array ( 0 => "1111", 1 => "2222" ) ); foreach($arrparcellabelnumber $val){ foreach($val['parcellabelnumber'] $key=>$v){ echo $val['weight'][$key] . "=" . $v; } }
you can simple too:
$c = count($arrparcellabelnumber["parcellabelnumber"]); ($i = 0; $i< $c; $i++) { if(isset($arrparcellabelnumber["parcellabelnumber"][$i]) && isset($arrparcellabelnumber["weight"][$i])){ echo $arrparcellabelnumber["parcellabelnumber"][$i] . " = " . $arrparcellabelnumber["weight"][$i]; } }
Comments
Post a Comment