I have an array like this :
$optionarray:
array(3) { [0]=> array(3) { [0]=> string(15) "Extension" [1]=> string(1) "1" [2]=> string(2) "10" } [1]=> array(3) { [0]=> string(15) "Extension" [1]=> string(1) "1" [2]=> string(2) "10" } [2]=> array(3) { [0]=> string(19) "Formation" [1]=> string(1) "1" [2]=> string(1) "0" } }
$dataarray:
array(2) { [0]=> array(3) { [0]=> string(23) "Physical room" [1]=> int(1) [2]=> string(7) "12,00 €" } [1]=> array(3) { [0]=> string(26) "user desk" [1]=> int(4) [2]=> string(7) "40,00 €" } }
$fullarray:
array(5) { [0]=> array(3) { [0]=> string(23) "Physical room" [1]=> int(1) [2]=> string(7) "12,00 €" } [1]=> array(3) { [0]=> string(26) "user desk" [1]=> int(4) [2]=> string(7) "40,00 €" } [2]=> array(3) { [0]=> array(3) { [0]=> string(15) "Extension" [1]=> string(1) "1" [2]=> string(2) "10" } [1]=> array(3) { [0]=> string(15) "Extension" [1]=> string(1) "1" [2]=> string(2) "10" } [2]=> array(3) { [0]=> string(19) "Formation " [1]=> string(1) "1" [2]=> string(1) "0" } } [3]=> array(3) { [0]=> array(3) { [0]=> string(15) "Extension" [1]=> string(1) "1" [2]=> string(2) "10" } [1]=> array(3) { [0]=> string(19) "Formation" [1]=> string(1) "1" [2]=> string(1) "0" } [2]=> NULL } [4]=> array(3) { [0]=> array(3) { [0]=> string(19) "Formation " [1]=> string(1) "1" [2]=> string(1) "0" } [1]=> NULL [2]=> NULL } }
My fullarray has not a unique structure , I want just to add $optionarray to $dataarray and iterate on $fullarray
My code :
$data[0] = array('Physical room', $nbprice, $totalprice);
$data[1] = array('user desk', $nbuser, $totaluserprice );
$i=2;
for($j=0;$j<count($optionsdata);$j++){
$data[$i]=array($optionsdata[$j],$optionsdata[$j+1],$optionsdata[$j+2]);
$i=$i+1;
}
How can I proceed for create my $fullarray properly for iterate and display each value ?
Expected output:
array(5){
[0]=>array(3){ [0]=> string(23) "Physical room" [1]=> int(1) [2]=> string(7) "12,00 €" }
[1]=> array(3) { [0]=> string(26) "user desk" [1]=> int(4) [2]=> string(7) "40,00 €" }
[2]=> array(3) { [0]=> array(3) { [0]=> string(15) "Extension" [1]=> string(1) "1" [2]=> string(2) "10" }
[3]=> array(3) { [0]=> string(15) "Extension" [1]=> string(1) "1" [2]=> string(2) "10" }
[4]=> array(3) { [0]=> string(19) "Formation " [1]=> string(1) "1" [2]=> string(1) "0" }
}