3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $recent_searches = array( 'test' => array( 'count' => 2, 'last_search' => 1234 ), 'test2' => array( 'count' => 2, 'last_search' => 1234 ), 'test3' => array( 'count' => 2, 'last_search' => 1234 ), 'test4' => array( 'count' => 2, 'last_search' => 1234 ), 'test5' => array( 'count' => 2, 'last_search' => 1234 ), ); $test = array_slice( $recent_searches, 3 ); var_dump( $recent_searches, $test );
Output for 7.0.20
array(5) { ["test"]=> array(2) { ["count"]=> int(2) ["last_search"]=> int(1234) } ["test2"]=> array(2) { ["count"]=> int(2) ["last_search"]=> int(1234) } ["test3"]=> array(2) { ["count"]=> int(2) ["last_search"]=> int(1234) } ["test4"]=> array(2) { ["count"]=> int(2) ["last_search"]=> int(1234) } ["test5"]=> array(2) { ["count"]=> int(2) ["last_search"]=> int(1234) } } array(2) { ["test4"]=> array(2) { ["count"]=> int(2) ["last_search"]=> int(1234) } ["test5"]=> array(2) { ["count"]=> int(2) ["last_search"]=> int(1234) } }