3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { private $a = '1a'; } class b { private $b = '2b'; } $r = [ new a, new b, new a, new b, new b, ]; var_dump(array_count_values($r));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: array_count_values(): Can only count string and integer values, entry skipped in /in/Kl4of on line 22 Warning: array_count_values(): Can only count string and integer values, entry skipped in /in/Kl4of on line 22 Warning: array_count_values(): Can only count string and integer values, entry skipped in /in/Kl4of on line 22 Warning: array_count_values(): Can only count string and integer values, entry skipped in /in/Kl4of on line 22 Warning: array_count_values(): Can only count string and integer values, entry skipped in /in/Kl4of on line 22 array(0) { }
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Warning: array_count_values(): Can only count STRING and INTEGER values! in /in/Kl4of on line 22 Warning: array_count_values(): Can only count STRING and INTEGER values! in /in/Kl4of on line 22 Warning: array_count_values(): Can only count STRING and INTEGER values! in /in/Kl4of on line 22 Warning: array_count_values(): Can only count STRING and INTEGER values! in /in/Kl4of on line 22 Warning: array_count_values(): Can only count STRING and INTEGER values! in /in/Kl4of on line 22 array(0) { }

preferences:
186.61 ms | 404 KiB | 268 Q