3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { public $i = 1; public function foo() { return ($this->i + 1); } public function increment() { if($quantity = $this->foo() > 0) { echo $quantity . "\n"; $this->i = $quantity; } } } $test = new a(); $test->increment(); $test->increment();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ldEVl
function name:  (null)
number of ops:  8
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'a'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_METHOD_CALL                                         !0, 'increment'
          4        DO_FCALL                                      0          
   24     5        INIT_METHOD_CALL                                         !0, 'increment'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class a:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ldEVl
function name:  foo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'i'
          1        ADD                                              ~1      ~0, 1
          2      > RETURN                                                   ~1
    9     3*     > RETURN                                                   null

End of function foo

Function increment:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/ldEVl
function name:  increment
number of ops:  10
compiled vars:  !0 = $quantity
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_METHOD_CALL                                         'foo'
          1        DO_FCALL                                      0  $1      
          2        IS_SMALLER                                       ~2      0, $1
          3        ASSIGN                                           ~3      !0, ~2
          4      > JMPZ                                                     ~3, ->9
   15     5    >   CONCAT                                           ~4      !0, '%0A'
          6        ECHO                                                     ~4
   16     7        ASSIGN_OBJ                                               'i'
          8        OP_DATA                                                  !0
   18     9    > > RETURN                                                   null

End of function increment

End of class a.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.4 ms | 1399 KiB | 13 Q