3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyCounter extends Counter { public function printCounterInfo() { printf("Counter's name is '%s' and is%s persistent. Its current value is %d.\n", $this->getMeta(COUNTER_META_NAME), $this->getMeta(COUNTER_META_IS_PERSISTENT) ? '' : ' not', $this->value); } } Counter::setCounterClass("MyCounter"); if (($counter_one = Counter::getNamed("one")) === NULL) { $counter_one = new Counter("one", 0, COUNTER_FLAG_PERSIST); } $counter_one->bumpValue(2); // we aren't allowed to "set" the value directly $counter_two = new Counter("two", 5); $counter_three = Counter::getNamed("three"); $counter_four = new Counter("four", 2, COUNTER_FLAG_PERSIST | COUNTER_FLAG_SAVE | COUNTER_FLAG_NO_OVERWRITE); $counter_four->bumpValue(1); $counter_one->printCounterInfo(); $counter_two->printCounterInfo(); $counter_three->printCounterInfo(); $counter_four->printCounterInfo(); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/GAVao
function name:  (null)
number of ops:  52
compiled vars:  !0 = $counter_one, !1 = $counter_two, !2 = $counter_three, !3 = $counter_four
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'mycounter', 'counter'
   12     1        INIT_STATIC_METHOD_CALL                                  'Counter', 'setCounterClass'
          2        SEND_VAL_EX                                              'MyCounter'
          3        DO_FCALL                                      0          
   13     4        INIT_STATIC_METHOD_CALL                                  'Counter', 'getNamed'
          5        SEND_VAL_EX                                              'one'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                           ~6      !0, $5
          8        TYPE_CHECK                                    2          ~6
          9      > JMPZ                                                     ~7, ->17
   14    10    >   NEW                                              $8      'Counter'
         11        SEND_VAL_EX                                              'one'
         12        SEND_VAL_EX                                              0
         13        FETCH_CONSTANT                                   ~9      'COUNTER_FLAG_PERSIST'
         14        SEND_VAL_EX                                              ~9
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !0, $8
   16    17    >   INIT_METHOD_CALL                                         !0, 'bumpValue'
         18        SEND_VAL_EX                                              2
         19        DO_FCALL                                      0          
   17    20        NEW                                              $13     'Counter'
         21        SEND_VAL_EX                                              'two'
         22        SEND_VAL_EX                                              5
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !1, $13
   18    25        INIT_STATIC_METHOD_CALL                                  'Counter', 'getNamed'
         26        SEND_VAL_EX                                              'three'
         27        DO_FCALL                                      0  $16     
         28        ASSIGN                                                   !2, $16
   19    29        NEW                                              $18     'Counter'
         30        SEND_VAL_EX                                              'four'
         31        SEND_VAL_EX                                              2
         32        FETCH_CONSTANT                                   ~19     'COUNTER_FLAG_PERSIST'
         33        FETCH_CONSTANT                                   ~20     'COUNTER_FLAG_SAVE'
         34        BW_OR                                            ~21     ~19, ~20
         35        FETCH_CONSTANT                                   ~22     'COUNTER_FLAG_NO_OVERWRITE'
         36        BW_OR                                            ~23     ~21, ~22
         37        SEND_VAL_EX                                              ~23
         38        DO_FCALL                                      0          
         39        ASSIGN                                                   !3, $18
   20    40        INIT_METHOD_CALL                                         !3, 'bumpValue'
         41        SEND_VAL_EX                                              1
         42        DO_FCALL                                      0          
   22    43        INIT_METHOD_CALL                                         !0, 'printCounterInfo'
         44        DO_FCALL                                      0          
   23    45        INIT_METHOD_CALL                                         !1, 'printCounterInfo'
         46        DO_FCALL                                      0          
   24    47        INIT_METHOD_CALL                                         !2, 'printCounterInfo'
         48        DO_FCALL                                      0          
   25    49        INIT_METHOD_CALL                                         !3, 'printCounterInfo'
         50        DO_FCALL                                      0          
   26    51      > RETURN                                                   1

Class MyCounter:
Function printcounterinfo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GAVao
function name:  printCounterInfo
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'printf'
          1        SEND_VAL                                                 'Counter%27s+name+is+%27%25s%27+and+is%25s+persistent.+Its+current+value+is+%25d.%0A'
    6     2        INIT_METHOD_CALL                                         'getMeta'
          3        FETCH_CONSTANT                                   ~0      'COUNTER_META_NAME'
          4        SEND_VAL_EX                                              ~0
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR                                                 $1
    7     7        INIT_METHOD_CALL                                         'getMeta'
          8        FETCH_CONSTANT                                   ~2      'COUNTER_META_IS_PERSISTENT'
          9        SEND_VAL_EX                                              ~2
         10        DO_FCALL                                      0  $3      
         11      > JMPZ                                                     $3, ->14
         12    >   QM_ASSIGN                                        ~4      ''
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~4      '+not'
         15    >   SEND_VAL                                                 ~4
    8    16        FETCH_OBJ_R                                      ~5      'value'
         17        SEND_VAL                                                 ~5
         18        DO_ICALL                                                 
    9    19      > RETURN                                                   null

End of function printcounterinfo

End of class MyCounter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.81 ms | 1392 KiB | 15 Q