3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $count = 4; public function getNext() { if (!$this->count) { return null; } --$this->count; return 'next'; } } $a = new Test(); for ($i = 0; $i < 10; $i++) { var_dump($a->count); var_dump($a->getNext() ?: 'none'); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 5
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 5
Branch analysis from position: 19
Branch analysis from position: 5
filename:       /in/9U3Jt
function name:  (null)
number of ops:  20
compiled vars:  !0 = $a, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   20     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->17
   21     5    >   INIT_FCALL                                               'var_dump'
          6        FETCH_OBJ_R                                      ~6      !0, 'count'
          7        SEND_VAL                                                 ~6
          8        DO_ICALL                                                 
   22     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'getNext'
         11        DO_FCALL                                      0  $8      
         12        JMP_SET                                          ~9      $8, ->14
         13        QM_ASSIGN                                        ~9      'none'
         14        SEND_VAL                                                 ~9
         15        DO_ICALL                                                 
   20    16        PRE_INC                                                  !1
         17    >   IS_SMALLER                                               !1, 10
         18      > JMPNZ                                                    ~12, ->5
   23    19    > > RETURN                                                   1

Class Test:
Function getnext:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9U3Jt
function name:  getNext
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'count'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->4
    9     3    > > RETURN                                                   null
   12     4    >   PRE_DEC_OBJ                                              'count'
   14     5      > RETURN                                                   'next'
   15     6*     > RETURN                                                   null

End of function getnext

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.84 ms | 1396 KiB | 15 Q