3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_equal_set() { return count(array_unique(array_map(function ($arr) { sort($arr); return serialize(array_unique($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; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/8Fprr
function name:  (null)
number of ops:  23
compiled vars:  !0 = $test_cases, !1 = $data, !2 = $test, !3 = $key, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   25     1        ASSIGN                                                   !1, <array>
   26     2      > FE_RESET_R                                       $7      !0, ->21
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->21
          4    >   ASSIGN                                                   !3, ~8
   27     5        INIT_FCALL                                               'array_equal_set'
          6        SEND_VAR                                                 !2
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0  $10     
          9      > JMPZ                                                     $10, ->12
         10    >   QM_ASSIGN                                        ~11     'TRUE'
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~11     'FALSE'
         13    >   ASSIGN                                                   !4, ~11
   28    14        ROPE_INIT                                     4  ~14     '%5B'
         15        ROPE_ADD                                      1  ~14     ~14, !3
         16        ROPE_ADD                                      2  ~14     ~14, '%5D'
         17        ROPE_END                                      3  ~13     ~14, !4
         18        CONCAT                                           ~16     ~13, '%0A'
         19        ECHO                                                     ~16
   26    20      > JMP                                                      ->3
         21    >   FE_FREE                                                  $7
   29    22      > RETURN                                                   1

Function array_equal_set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Fprr
function name:  array_equal_set
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'array_unique'
          1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F8Fprr%3A4%240'
    7     3        SEND_VAL                                                 ~0
          4        FUNC_GET_ARGS                                    ~1      
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                         $3      
          9        COUNT                                            ~4      $3
         10        IS_IDENTICAL                                     ~5      ~4, 1
         11      > RETURN                                                   ~5
    8    12*     > RETURN                                                   null

End of function array_equal_set

Function %00%7Bclosure%7D%2Fin%2F8Fprr%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Fprr
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'sort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
    6     4        INIT_FCALL                                               'serialize'
          5        INIT_FCALL                                               'array_unique'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10      > RETURN                                                   $3
    7    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F8Fprr%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.33 ms | 1403 KiB | 22 Q