3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = ['ka' => 'va', 'kb' => 'vb', 'kc' => 'vc']; $part = array_slice($arr, 1, 1, true); $key = key($part); $value = current($part); var_dump($arr, $part, $key, $value);
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.2.7
array(3) { ["ka"]=> string(2) "va" ["kb"]=> string(2) "vb" ["kc"]=> string(2) "vc" } array(1) { ["kb"]=> string(2) "vb" } string(2) "kb" string(2) "vb"