3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dbquery_results1[0] = array("1","5","b99"); $dbquery_results1[1] = array("4","12","www"); $dbquery_results1[2] = array("10","32","ccc"); $dbquery_results1[3] = array("7","142","xx"); $dbquery_results2[0] = array("c","10"); $dbquery_results2[1] = array("as","1"); $dbquery_results2[2] = array("fe","7"); foreach($dbquery_results1 as $line_r1) { foreach($dbquery_results2 as $line_r2) { if($line_r1[0] == $line_r2[1]) { $line = $line_r1; $line[] = $line_r2[0]; $dbquery_combination[] = $line; } } } print_r($dbquery_combination); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => 1 [1] => 5 [2] => b99 [3] => as ) [1] => Array ( [0] => 10 [1] => 32 [2] => ccc [3] => c ) [2] => Array ( [0] => 7 [1] => 142 [2] => xx [3] => fe ) )