例如,这是一个数组:
$array = array(
'firstIndex' => 'Tom',
'secondIndex' => 'John',
'thirdIndex' => 'Cavanagh',
'fourthIndex' => 'Gustin',
'fifthIndex' => 'Stephen',
'sixthIndex' => 'Amell',
'seventhIndex' => 'Robbie',
'eighthIndex' => 'Cisco'
);
有没有什么方法可以在'fourthIndex'键后得到所有索引?像这样:
$someVar = array_get_indexes_after_key('fourthIndex', $array);
var_dump($someVar);
将返回:
array(4) {
["fifthIndex"]=>
string(7) "Stephen"
["sixthIndex"]=>
string(5) "Amell"
["seventhIndex"]=>
string(6) "Robbie"
["eighthIndex"]=>
string(5) "Cisco"
}
我该怎么做?任何建议都是真的很感激。