3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input_arr= array( 0=>array("india0","srilanka1","pakistan0","banglades0"), 1=>array("india1","srilanka1","pakistan1","bangladesh1"), 2=>array("india2","srilanka2","pakistan2","bangladesh2"), 3=>array("india3","srilanka3","pakistan3","bangladesh3"), 4=>array("india4","srilanka4","pakistan4","bangladesh4"), 5=>array("india5","srilanka5","pakistan5","bangladesh5"), ); $result_arr= array(array()); for($i=0;$i<sizeof($input_arr);$i++) { if(in_array("banglades0",$input_arr[$i])) if(in_array("india0",$input_arr[$i])) $result_arr = $input_arr; } print_r($input_arr);
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( [0] => india0 [1] => srilanka1 [2] => pakistan0 [3] => banglades0 ) [1] => Array ( [0] => india1 [1] => srilanka1 [2] => pakistan1 [3] => bangladesh1 ) [2] => Array ( [0] => india2 [1] => srilanka2 [2] => pakistan2 [3] => bangladesh2 ) [3] => Array ( [0] => india3 [1] => srilanka3 [2] => pakistan3 [3] => bangladesh3 ) [4] => Array ( [0] => india4 [1] => srilanka4 [2] => pakistan4 [3] => bangladesh4 ) [5] => Array ( [0] => india5 [1] => srilanka5 [2] => pakistan5 [3] => bangladesh5 ) )