3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['Susan', 'Mark', 'Susan', 'Stephan']; $valuesCounted = array_count_values($array); $unique = array_unique($array); $duplicates = array_filter($valuesCounted, function($var) { return $var > 1; }); $final = $unique; $final['duplicates'] = $duplicates; var_dump($final);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> string(5) "Susan" [1]=> string(4) "Mark" [3]=> string(7) "Stephan" ["duplicates"]=> array(1) { ["Susan"]=> int(2) } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
163.87 ms | 405 KiB | 5 Q