3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array( 'index1' => 'Deleted', 'index2' => 'numbers', 'index3' => 'test', 'index4' => 'Inserted', ); $i=0; $specificIndex = array('index3','index2') ; $array1=array(); if(key($array)==$specificIndex[$i]){ $array1[$key] = $value; unset($array[$specificIndex[$i]]); $i++; } print_r($specificIndex); print_r($array); print_r($array1);
based on SW2MW
Output for 4.3.0 - 7.2.0
Array ( [0] => index3 [1] => index2 ) Array ( [index1] => Deleted [index2] => numbers [index3] => test [index4] => Inserted ) Array ( )