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++) { $resultArray[] = array("number"=>$inputArray[$i["number"]], "carrier"=>$inputArray[++$i["carrier"]]); } print_r($resultArray);
based on QTR12
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Notice: Undefined index: in /in/eij18 on line 8 Warning: Cannot use a scalar value as an array in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Warning: Cannot use a scalar value as an array in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Warning: Cannot use a scalar value as an array in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Warning: Cannot use a scalar value as an array in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Array ( [0] => Array ( [number] => [carrier] => ) [1] => Array ( [number] => [carrier] => ) [2] => Array ( [number] => [carrier] => ) [3] => Array ( [number] => [carrier] => ) )
Output for 4.3.0 - 5.2.17
Notice: Undefined index: in /in/eij18 on line 8 Warning: Cannot use a scalar value as an array in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Warning: Cannot use a scalar value as an array in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Warning: Cannot use a scalar value as an array in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Warning: Cannot use a scalar value as an array in /in/eij18 on line 8 Notice: Undefined index: in /in/eij18 on line 8 Array ( [0] => Array ( [number] => [carrier] => ) [1] => Array ( [number] => [carrier] => ) [2] => Array ( [number] => [carrier] => ) [3] => Array ( [number] => [carrier] => ) )