3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $iWannaUseThePikey = array( // Look ma, it's an array 'foo' => '1', 'bar' => '2', 'baz' => '3', 'zip' => '1'); // This doesn't. Let's cast the array to an array just to make sure... oh ok now it's an array $avi = array_count_values((array)$iWannaUseThePikey); var_dump($iWannaUseThePikey); var_dump((array)$iWannaUseThePikey); var_dump($avi);
Output for 4.3.0 - 4.4.9, 5.0.2 - 7.1.0
array(4) { ["foo"]=> string(1) "1" ["bar"]=> string(1) "2" ["baz"]=> string(1) "3" ["zip"]=> string(1) "1" } array(4) { ["foo"]=> string(1) "1" ["bar"]=> string(1) "2" ["baz"]=> string(1) "3" ["zip"]=> string(1) "1" } array(3) { [1]=> int(2) [2]=> int(1) [3]=> int(1) }
Output for 5.0.0 - 5.0.1
array(4) { ["foo"]=> string(1) "1" ["bar"]=> string(1) "2" ["baz"]=> string(1) "3" ["zip"]=> string(1) "1" } array(4) { ["foo"]=> string(1) "1" ["bar"]=> string(1) "2" ["baz"]=> string(1) "3" ["zip"]=> string(1) "1" } array(3) { ["1"]=> int(2) ["2"]=> int(1) ["3"]=> int(1) }