3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function array_equal_set() { return count(array_unique(array_map(function ($arr) { $arr = array_unique($arr); sort($arr); return serialize($arr); }, func_get_args()))) === 1; } $test_cases = array( /* 0 */ array( 'A' , 'B' , 'C' ), /* 1 */ array( 'A' , 'C' , 'B' ), /* 2 */ array( 'B' , 'A' , 'C' ), /* 3 */ array( 'B' , 'C' , 'A' ), /* 4 */ array( 'C' , 'A' , 'B' ), /* 5 */ array( 'C' , 'B' , 'A' ), /* 6 */ array( 'A' , 'B' , 'C' , 'D' ), /* 7 */ array( 'A' , 'B' , 'D' ), /* 8 */ array( 'A' , 'B' , 'B' ), /* 9 */ array( 'A' , 'B' ), /* 10 */ array( 'A' , 'B' , 'C' , 'B' ), ); // test $data = array( 'A' , 'B' , 'C' ); foreach( $test_cases as $key => $test ){ $result = array_equal_set( $test, $data ) ? 'TRUE' : 'FALSE' ; echo "[$key]$result" . PHP_EOL; }
Output for 5.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
[0]TRUE [1]TRUE [2]TRUE [3]TRUE [4]TRUE [5]TRUE [6]FALSE [7]FALSE [8]FALSE [9]FALSE [10]TRUE
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/8lQV6 on line 4
Process exited with code 255.
Output for 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/8lQV6 on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/8lQV6 on line 4
Process exited with code 255.
Output for 4.3.0
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/U1dm9 on line 4
Process exited with code 255.