3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { static $count; function b() { if (null === static::$count) { static::$count = 1; return ['a', 'b']; } return static::$count++; } } $a = new A; var_dump($a->b(), $a->b()); A::$count = null; $a = new A; var_dump($a->b()[$a->b()]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VdZaE
function name:  (null)
number of ops:  25
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'b'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        INIT_METHOD_CALL                                         !0, 'b'
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
   21    11        ASSIGN_STATIC_PROP                                       'count', 'A'
         12        OP_DATA                                                  null
   22    13        NEW                                              $8      'A'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !0, $8
   24    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'b'
         18        DO_FCALL                                      0  $11     
         19        INIT_METHOD_CALL                                         !0, 'b'
         20        DO_FCALL                                      0  $12     
         21        FETCH_DIM_R                                      ~13     $11, $12
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Class A:
Function b:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VdZaE
function name:  b
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'count'
          1        TYPE_CHECK                                    2          ~0
          2      > JMPZ                                                     ~1, ->6
   10     3    >   ASSIGN_STATIC_PROP                                       'count'
          4        OP_DATA                                                  1
   11     5      > RETURN                                                   <array>
   14     6    >   POST_INC_STATIC_PROP                             ~3      'count'
          7      > RETURN                                                   ~3
   15     8*     > RETURN                                                   null

End of function b

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.37 ms | 1396 KiB | 15 Q