1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <?php $dict = ['a' , 'b' , 'c' , 'd' , 'e'];
$position = array_search('c', $dict); $totalSize = count($dict); $findOut = array_slice($dict, $position, $totalSize); $findOutSize = count($findOut);
if ($findOutSize < $totalSize) { $appendSize = $totalSize - $findOutSize; $appendDict = array_slice($dict, 0, $appendSize); }else{ $appendDict = []; }
print_r(array_merge($findOut, $appendDict));
|