3v4l.org

run code in 300+ PHP versions simultaneously
<?php $left = 4; $right = '4'; function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);} it("should compare simple values as equals", $left == $right); it("should NOT compare ints and strings as equals if using identity", $left === $right); it("should compare by identity if you typecast a string to an int", $left === (int) $right); it("should compare by identity if you typecast an int to a string", (string) $left === $right);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MeD0V
function name:  (null)
number of ops:  25
compiled vars:  !0 = $left, !1 = $right
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 4
    4     1        ASSIGN                                                   !1, '4'
    8     2        INIT_FCALL                                               'it'
          3        SEND_VAL                                                 'should+compare+simple+values+as+equals'
          4        IS_EQUAL                                         ~4      !0, !1
          5        SEND_VAL                                                 ~4
          6        DO_FCALL                                      0          
    9     7        INIT_FCALL                                               'it'
          8        SEND_VAL                                                 'should+NOT+compare+ints+and+strings+as+equals+if+using+identity'
          9        IS_IDENTICAL                                     ~6      !0, !1
         10        SEND_VAL                                                 ~6
         11        DO_FCALL                                      0          
   10    12        INIT_FCALL                                               'it'
         13        SEND_VAL                                                 'should+compare+by+identity+if+you+typecast+a+string+to+an+int'
         14        CAST                                          4  ~8      !1
         15        IS_IDENTICAL                                     ~9      !0, ~8
         16        SEND_VAL                                                 ~9
         17        DO_FCALL                                      0          
   11    18        INIT_FCALL                                               'it'
         19        SEND_VAL                                                 'should+compare+by+identity+if+you+typecast+an+int+to+a+string'
         20        CAST                                          6  ~11     !0
         21        IS_IDENTICAL                                     ~12     !1, ~11
         22        SEND_VAL                                                 ~12
         23        DO_FCALL                                      0          
         24      > 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/MeD0V
function name:  it
number of ops:  17
compiled vars:  !0 = $m, !1 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     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/MeD0V
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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.11 ms | 1407 KiB | 17 Q