3v4l.org

run code in 300+ PHP versions simultaneously
<?php // A unit testing framework in a tweet. https://gist.github.com/mathiasverraes/9046427 function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);} function consistsOfTheSameValues(array $a, array $b) { return count(array_diff(array_merge($a, $b), array_intersect($a, $b))) === 0; } it('consist of the same values', consistsOfTheSameValues([1], [1]) === true ); it('consist of the same values', consistsOfTheSameValues([1, 1], [1, 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['1', 1], ['1', 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['1', 1], [1, '1']) === true ); it('consist of the same values', consistsOfTheSameValues([1, '1'], ['1', 1]) === true ); it('consist of the same values', consistsOfTheSameValues([1, '1'], [1, '1']) === true ); it('consist of the same values', consistsOfTheSameValues(['x' => 1], ['x' => 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['x' => 1], ['y' => 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['y' => 1], ['x' => 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['x' => 1, 'y' => 1], ['x' => 1, 'y' => 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['y' => 1, 'x' => 1], ['x' => 1, 'y' => 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['x' => 1, 'y' => 1], ['y' => 1, 'x' => 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['y' => 1, 'x' => 1], ['y' => 1, 'x' => 1]) === true ); it('consist of the same values', consistsOfTheSameValues(['x' => 2, 'y' => 1], ['x' => 1, 'y' => 2]) === true ); it('does not consist of the same values', consistsOfTheSameValues([1], [2]) === false ); it('does not consist of the same values', consistsOfTheSameValues(['1'], [1]) === false ); it('does not consist of the same values', consistsOfTheSameValues([1], ['1']) === false ); it('does not consist of the same values', consistsOfTheSameValues([1], [1, 1]) === false ); it('does not consist of the same values', consistsOfTheSameValues([1, 1], [1]) === false ); it('does not consist of the same values', consistsOfTheSameValues(['1', 1], [1, 1]) === false ); it('does not consist of the same values', consistsOfTheSameValues([1, '1'], [1, 1]) === false ); it('does not consist of the same values', consistsOfTheSameValues([1, 1], ['1', 1]) === false ); it('does not consist of the same values', consistsOfTheSameValues([1, 1], [1, '1']) === false ); it('does not consist of the same values', consistsOfTheSameValues(['1', '1'], [1, 1]) === false ); it('does not consist of the same values', consistsOfTheSameValues(['1', '1'], ['1', 1]) === false ); it('does not consist of the same values', consistsOfTheSameValues(['1', '1'], [1, '1']) === false ); it('does not consist of the same values', consistsOfTheSameValues([1, 1], ['1', '1']) === false ); it('does not consist of the same values', consistsOfTheSameValues(['1', 1], ['1', '1']) === false ); it('does not consist of the same values', consistsOfTheSameValues([1, '1'], ['1', '1']) === false ); it('does not consist of the same values', consistsOfTheSameValues(['x' => 1], ['x' => 2]) === false ); it('does not consist of the same values', consistsOfTheSameValues(['x' => 1, 'y' => 1], ['x' => 1, 'y' => 2]) === false ); it('does not consist of the same values', consistsOfTheSameValues(['x' => 1, 'y' => 1], ['x' => 2, 'y' => 1]) === false ); it('does not consist of the same values', consistsOfTheSameValues(['x' => 2, 'y' => 1], ['x' => 1, 'y' => 1]) === false );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ivgm
function name:  (null)
number of ops:  298
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'it'
          1        SEND_VAL                                                 'consist+of+the+same+values'
   12     2        INIT_FCALL                                               'consistsofthesamevalues'
          3        SEND_VAL                                                 <array>
          4        SEND_VAL                                                 <array>
          5        DO_FCALL                                      0  $0      
          6        TYPE_CHECK                                    8  ~1      $0
          7        SEND_VAL                                                 ~1
          8        DO_FCALL                                      0          
   15     9        INIT_FCALL                                               'it'
         10        SEND_VAL                                                 'consist+of+the+same+values'
   16    11        INIT_FCALL                                               'consistsofthesamevalues'
         12        SEND_VAL                                                 <array>
         13        SEND_VAL                                                 <array>
         14        DO_FCALL                                      0  $3      
         15        TYPE_CHECK                                    8  ~4      $3
         16        SEND_VAL                                                 ~4
         17        DO_FCALL                                      0          
   19    18        INIT_FCALL                                               'it'
         19        SEND_VAL                                                 'consist+of+the+same+values'
   20    20        INIT_FCALL                                               'consistsofthesamevalues'
         21        SEND_VAL                                                 <array>
         22        SEND_VAL                                                 <array>
         23        DO_FCALL                                      0  $6      
         24        TYPE_CHECK                                    8  ~7      $6
         25        SEND_VAL                                                 ~7
         26        DO_FCALL                                      0          
   23    27        INIT_FCALL                                               'it'
         28        SEND_VAL                                                 'consist+of+the+same+values'
   24    29        INIT_FCALL                                               'consistsofthesamevalues'
         30        SEND_VAL                                                 <array>
         31        SEND_VAL                                                 <array>
         32        DO_FCALL                                      0  $9      
         33        TYPE_CHECK                                    8  ~10     $9
         34        SEND_VAL                                                 ~10
         35        DO_FCALL                                      0          
   27    36        INIT_FCALL                                               'it'
         37        SEND_VAL                                                 'consist+of+the+same+values'
   28    38        INIT_FCALL                                               'consistsofthesamevalues'
         39        SEND_VAL                                                 <array>
         40        SEND_VAL                                                 <array>
         41        DO_FCALL                                      0  $12     
         42        TYPE_CHECK                                    8  ~13     $12
         43        SEND_VAL                                                 ~13
         44        DO_FCALL                                      0          
   31    45        INIT_FCALL                                               'it'
         46        SEND_VAL                                                 'consist+of+the+same+values'
   32    47        INIT_FCALL                                               'consistsofthesamevalues'
         48        SEND_VAL                                                 <array>
         49        SEND_VAL                                                 <array>
         50        DO_FCALL                                      0  $15     
         51        TYPE_CHECK                                    8  ~16     $15
         52        SEND_VAL                                                 ~16
         53        DO_FCALL                                      0          
   35    54        INIT_FCALL                                               'it'
         55        SEND_VAL                                                 'consist+of+the+same+values'
   36    56        INIT_FCALL                                               'consistsofthesamevalues'
         57        SEND_VAL                                                 <array>
         58        SEND_VAL                                                 <array>
         59        DO_FCALL                                      0  $18     
         60        TYPE_CHECK                                    8  ~19     $18
         61        SEND_VAL                                                 ~19
         62        DO_FCALL                                      0          
   39    63        INIT_FCALL                                               'it'
         64        SEND_VAL                                                 'consist+of+the+same+values'
   40    65        INIT_FCALL                                               'consistsofthesamevalues'
         66        SEND_VAL                                                 <array>
         67        SEND_VAL                                                 <array>
         68        DO_FCALL                                      0  $21     
         69        TYPE_CHECK                                    8  ~22     $21
         70        SEND_VAL                                                 ~22
         71        DO_FCALL                                      0          
   43    72        INIT_FCALL                                               'it'
         73        SEND_VAL                                                 'consist+of+the+same+values'
   44    74        INIT_FCALL                                               'consistsofthesamevalues'
         75        SEND_VAL                                                 <array>
         76        SEND_VAL                                                 <array>
         77        DO_FCALL                                      0  $24     
         78        TYPE_CHECK                                    8  ~25     $24
         79        SEND_VAL                                                 ~25
         80        DO_FCALL                                      0          
   47    81        INIT_FCALL                                               'it'
         82        SEND_VAL                                                 'consist+of+the+same+values'
   48    83        INIT_FCALL                                               'consistsofthesamevalues'
         84        SEND_VAL                                                 <array>
         85        SEND_VAL                                                 <array>
         86        DO_FCALL                                      0  $27     
         87        TYPE_CHECK                                    8  ~28     $27
         88        SEND_VAL                                                 ~28
         89        DO_FCALL                                      0          
   51    90        INIT_FCALL                                               'it'
         91        SEND_VAL                                                 'consist+of+the+same+values'
   52    92        INIT_FCALL                                               'consistsofthesamevalues'
         93        SEND_VAL                                                 <array>
         94        SEND_VAL                                                 <array>
         95        DO_FCALL                                      0  $30     
         96        TYPE_CHECK                                    8  ~31     $30
         97        SEND_VAL                                                 ~31
         98        DO_FCALL                                      0          
   55    99        INIT_FCALL                                               'it'
        100        SEND_VAL                                                 'consist+of+the+same+values'
   56   101        INIT_FCALL                                               'consistsofthesamevalues'
        102        SEND_VAL                                                 <array>
        103        SEND_VAL                                                 <array>
        104        DO_FCALL                                      0  $33     
        105        TYPE_CHECK                                    8  ~34     $33
        106        SEND_VAL                                                 ~34
        107        DO_FCALL                                      0          
   59   108        INIT_FCALL                                               'it'
        109        SEND_VAL                                                 'consist+of+the+same+values'
   60   110        INIT_FCALL                                               'consistsofthesamevalues'
        111        SEND_VAL                                                 <array>
        112        SEND_VAL                                                 <array>
        113        DO_FCALL                                      0  $36     
        114        TYPE_CHECK                                    8  ~37     $36
        115        SEND_VAL                                                 ~37
        116        DO_FCALL                                      0          
   63   117        INIT_FCALL                                               'it'
        118        SEND_VAL                                                 'consist+of+the+same+values'
   64   119        INIT_FCALL                                               'consistsofthesamevalues'
        120        SEND_VAL                                                 <array>
        121        SEND_VAL                                                 <array>
        122        DO_FCALL                                      0  $39     
        123        TYPE_CHECK                                    8  ~40     $39
        124        SEND_VAL                                                 ~40
        125        DO_FCALL                                      0          
   67   126        INIT_FCALL                                               'it'
        127        SEND_VAL                                                 'does+not+consist+of+the+same+values'
   68   128        INIT_FCALL                                               'consistsofthesamevalues'
        129        SEND_VAL                                                 <array>
        130        SEND_VAL                                                 <array>
        131        DO_FCALL                                      0  $42     
        132        TYPE_CHECK                                    4  ~43     $42
        133        SEND_VAL                                                 ~43
        134        DO_FCALL                                      0          
   71   135        INIT_FCALL                                               'it'
        136        SEND_VAL                                                 'does+not+consist+of+the+same+values'
   72   137        INIT_FCALL                                               'consistsofthesamevalues'
        138        SEND_VAL                                                 <array>
        139        SEND_VAL                                                 <array>
        140        DO_FCALL                                      0  $45     
        141        TYPE_CHECK                                    4  ~46     $45
        142        SEND_VAL                                                 ~46
        143        DO_FCALL                                      0          
   75   144        INIT_FCALL                                               'it'
        145        SEND_VAL                                                 'does+not+consist+of+the+same+values'
   76   146        INIT_FCALL                                               'consistsofthesamevalues'
        147        SEND_VAL                                                 <array>
        148        SEND_VAL                                                 <array>
        149        DO_FCALL                                      0  $48     
        150        TYPE_CHECK                                    4  ~49     $48
        151        SEND_VAL                                                 ~49
        152        DO_FCALL                                      0          
   79   153        INIT_FCALL                                               'it'
        154        SEND_VAL                                                 'does+not+consist+of+the+same+values'
   80   155        INIT_FCALL                                               'consistsofthesamevalues'
        156        SEND_VAL                                                 <array>
        157        SEND_VAL                                                 <array>
        158        DO_FCALL                                      0  $51     
        159        TYPE_CHECK                                    4  ~52     $51
        160        SEND_VAL                                                 ~52
        161        DO_FCALL                                      0          
   83   162        INIT_FCALL                                               'it'
        163        SEND_VAL                                                 'does+not+consist+of+the+same+values'
   84   164        INIT_FCALL                                               'consistsofthesamevalues'
        165        SEND_VAL                                                 <array>
        166        SEND_VAL                                                 <array>
        167        DO_FCALL                                      0  $54     
        168        TYPE_CHECK                                    4  ~55     $54
        169        SEND_VAL                                                 ~55
        170        DO_FCALL                                      0          
   87   171        INIT_FCALL                                               'it'
        172        SEND_VAL                                                 'does+not+consist+of+the+same+values'
   88   173        INIT_FCALL                                               'consistsofthesamevalues'
        174        SEND_VAL                                                 <array>
        175        SEND_VAL                                                 <array>
        176        DO_FCALL                                      0  $57     
        177        TYPE_CHECK                                    4  ~58     $57
        178        SEND_VAL                                                 ~58
        179        DO_FCALL                                      0          
   91   180        INIT_FCALL                                               'it'
        181        SEND_VAL                                                 'does+not+consist+of+the+same+values'
   92   182        INIT_FCALL                                               'consistsofthesamevalues'
        183        SEND_VAL                                                 <array>
        184        SEND_VAL                                                 <array>
        185        DO_FCALL                                      0  $60     
        186        TYPE_CHECK                                    4  ~61     $60
        187        SEND_VAL                                                 ~61
        188        DO_FCALL                                      0          
   95   189        INIT_FCALL                                               'it'
        190        SEND_VAL                                                 'does+not+consist+of+the+same+values'
   96   191        INIT_FCALL                                               'consistsofthesamevalues'
        192        SEND_VAL                                                 <array>
        193        SEND_VAL                                                 <array>
        194        DO_FCALL                                      0  $63     
        195        TYPE_CHECK                                    4  ~64     $63
        196        SEND_VAL                                                 ~64
        197        DO_FCALL                                      0          
   99   198        INIT_FCALL                                               'it'
        199        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  100   200        INIT_FCALL                                               'consistsofthesamevalues'
        201        SEND_VAL                                                 <array>
        202        SEND_VAL                                                 <array>
        203        DO_FCALL                                      0  $66     
        204        TYPE_CHECK                                    4  ~67     $66
        205        SEND_VAL                                                 ~67
        206        DO_FCALL                                      0          
  103   207        INIT_FCALL                                               'it'
        208        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  104   209        INIT_FCALL                                               'consistsofthesamevalues'
        210        SEND_VAL                                                 <array>
        211        SEND_VAL                                                 <array>
        212        DO_FCALL                                      0  $69     
        213        TYPE_CHECK                                    4  ~70     $69
        214        SEND_VAL                                                 ~70
        215        DO_FCALL                                      0          
  107   216        INIT_FCALL                                               'it'
        217        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  108   218        INIT_FCALL                                               'consistsofthesamevalues'
        219        SEND_VAL                                                 <array>
        220        SEND_VAL                                                 <array>
        221        DO_FCALL                                      0  $72     
        222        TYPE_CHECK                                    4  ~73     $72
        223        SEND_VAL                                                 ~73
        224        DO_FCALL                                      0          
  111   225        INIT_FCALL                                               'it'
        226        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  112   227        INIT_FCALL                                               'consistsofthesamevalues'
        228        SEND_VAL                                                 <array>
        229        SEND_VAL                                                 <array>
        230        DO_FCALL                                      0  $75     
        231        TYPE_CHECK                                    4  ~76     $75
        232        SEND_VAL                                                 ~76
        233        DO_FCALL                                      0          
  115   234        INIT_FCALL                                               'it'
        235        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  116   236        INIT_FCALL                                               'consistsofthesamevalues'
        237        SEND_VAL                                                 <array>
        238        SEND_VAL                                                 <array>
        239        DO_FCALL                                      0  $78     
        240        TYPE_CHECK                                    4  ~79     $78
        241        SEND_VAL                                                 ~79
        242        DO_FCALL                                      0          
  119   243        INIT_FCALL                                               'it'
        244        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  120   245        INIT_FCALL                                               'consistsofthesamevalues'
        246        SEND_VAL                                                 <array>
        247        SEND_VAL                                                 <array>
        248        DO_FCALL                                      0  $81     
        249        TYPE_CHECK                                    4  ~82     $81
        250        SEND_VAL                                                 ~82
        251        DO_FCALL                                      0          
  123   252        INIT_FCALL                                               'it'
        253        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  124   254        INIT_FCALL                                               'consistsofthesamevalues'
        255        SEND_VAL                                                 <array>
        256        SEND_VAL                                                 <array>
        257        DO_FCALL                                      0  $84     
        258        TYPE_CHECK                                    4  ~85     $84
        259        SEND_VAL                                                 ~85
        260        DO_FCALL                                      0          
  127   261        INIT_FCALL                                               'it'
        262        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  128   263        INIT_FCALL                                               'consistsofthesamevalues'
        264        SEND_VAL                                                 <array>
        265        SEND_VAL                                                 <array>
        266        DO_FCALL                                      0  $87     
        267        TYPE_CHECK                                    4  ~88     $87
        268        SEND_VAL                                                 ~88
        269        DO_FCALL                                      0          
  131   270        INIT_FCALL                                               'it'
        271        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  132   272        INIT_FCALL                                               'consistsofthesamevalues'
        273        SEND_VAL                                                 <array>
        274        SEND_VAL                                                 <array>
        275        DO_FCALL                                      0  $90     
        276        TYPE_CHECK                                    4  ~91     $90
        277        SEND_VAL                                                 ~91
        278        DO_FCALL                                      0          
  135   279        INIT_FCALL                                               'it'
        280        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  136   281        INIT_FCALL                                               'consistsofthesamevalues'
        282        SEND_VAL                                                 <array>
        283        SEND_VAL                                                 <array>
        284        DO_FCALL                                      0  $93     
        285        TYPE_CHECK                                    4  ~94     $93
        286        SEND_VAL                                                 ~94
        287        DO_FCALL                                      0          
  139   288        INIT_FCALL                                               'it'
        289        SEND_VAL                                                 'does+not+consist+of+the+same+values'
  140   290        INIT_FCALL                                               'consistsofthesamevalues'
        291        SEND_VAL                                                 <array>
        292        SEND_VAL                                                 <array>
        293        DO_FCALL                                      0  $96     
        294        TYPE_CHECK                                    4  ~97     $96
        295        SEND_VAL                                                 ~97
        296        DO_FCALL                                      0          
  141   297      > RETURN                                                   1

Function it:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
Branch analysis from position: 16
filename:       /in/5ivgm
function name:  it
number of ops:  17
compiled vars:  !0 = $m, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > JMPZ                                                     !1, ->5
          3    >   QM_ASSIGN                                        ~2      '%E2%9C%94%EF%B8%8E'
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~2      '%E2%9C%98'
          6    >   ROPE_INIT                                     3  ~4      '+It+'
          7        ROPE_ADD                                      1  ~4      ~4, !0
          8        ROPE_END                                      2  ~3      ~4, '%0A'
          9        CONCAT                                           ~6      ~2, ~3
         10        ECHO                                                     ~6
         11        BOOL_NOT                                         ~7      !1
         12      > JMPZ                                                     ~7, ->16
         13    >   FETCH_W                      global              $8      'GLOBALS'
         14        ASSIGN_DIM                                               $8, 'f'
         15        OP_DATA                                                  1
         16    > > RETURN                                                   null

End of function it

Function done:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ivgm
function name:  done
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   BEGIN_SILENCE                                    ~0      
          1        FETCH_R                      global              ~1      'GLOBALS'
          2        FETCH_DIM_R                                      ~2      ~1, 'f'
          3        END_SILENCE                                              ~0
          4      > JMPZ                                                     ~2, ->6
          5    > > EXIT                                                     1
          6    > > RETURN                                                   null

End of function done

Function consistsofthesamevalues:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ivgm
function name:  consistsOfTheSameValues
number of ops:  18
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'array_diff'
          3        INIT_FCALL                                               'array_merge'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        INIT_FCALL                                               'array_intersect'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                         $4      
         14        COUNT                                            ~5      $4
         15        IS_IDENTICAL                                     ~6      ~5, 0
         16      > RETURN                                                   ~6
    9    17*     > RETURN                                                   null

End of function consistsofthesamevalues

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
203.59 ms | 1427 KiB | 85 Q