1--TEST-- 2array_keys() and array_values() w/ packed optimization 3--FILE-- 4<?php 5 6$x = [1,2,3]; 7unset($x[1]); 8 9$inputs = [ 10 [], 11 [1,2,3], 12 [0=>1, 1=>2, 2=>3], 13 [1=>1, 2=>2, 3=>3], 14 [0=>1, 2=>3], 15 $x, 16]; 17 18foreach ($inputs as $input) { 19 print_r(array_keys($input)); 20 print_r(array_values($input)); 21} 22--EXPECT-- 23Array 24( 25) 26Array 27( 28) 29Array 30( 31 [0] => 0 32 [1] => 1 33 [2] => 2 34) 35Array 36( 37 [0] => 1 38 [1] => 2 39 [2] => 3 40) 41Array 42( 43 [0] => 0 44 [1] => 1 45 [2] => 2 46) 47Array 48( 49 [0] => 1 50 [1] => 2 51 [2] => 3 52) 53Array 54( 55 [0] => 1 56 [1] => 2 57 [2] => 3 58) 59Array 60( 61 [0] => 1 62 [1] => 2 63 [2] => 3 64) 65Array 66( 67 [0] => 0 68 [1] => 2 69) 70Array 71( 72 [0] => 1 73 [1] => 3 74) 75Array 76( 77 [0] => 0 78 [1] => 2 79) 80Array 81( 82 [0] => 1 83 [1] => 3 84) 85