3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $inputArray = array(array("number"=>"+918800499626"), array("carrier"=>"asdasd"), array("number"=>"342423"), array("carrier"=>"assssssss")); $resultArray = array(); for($i = 0; $i < count($inputArray); $i++) { if(isset($inputArray[$i]) && isset($inputArray[$i+1])) { $resultArray[] = array("number"=>$inputArray[$i]["number"], "carrier"=>$inputArray[++$i]["carrier"]); } } print_r($resultArray);
based on sreaN
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( [number] => +918800499626 [carrier] => asdasd ) [1] => Array ( [number] => 342423 [carrier] => assssssss ) )