3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SomeHelperClass { public $_arr = []; public function addValue($value, $key = null): void { if ($key !== null) { $this->_arr[$key] = $value; } else { for ($i = 0, $count = count($this->_arr); $i <= $count; ++$i) { if (!key_exists($i, $this->_arr)) { $this->_arr[$i] = $value; break; } } } } } $test = new SomeHelperClass; var_export($test->_arr); echo "\n"; $test->addValue(1); var_export($test->_arr); echo "\n"; $test->addValue(2); var_export($test->_arr); echo "\n"; $test->addValue(3, 4); var_export($test->_arr); echo "\n"; $test->addValue(4, 3); var_export($test->_arr); echo "\n"; $test->addValue(5); var_export($test->_arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3rl23
function name:  (null)
number of ops:  50
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'SomeHelperClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_FCALL                                               'var_export'
          4        FETCH_OBJ_R                                      ~4      !0, '_arr'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   23     7        ECHO                                                     '%0A'
   25     8        INIT_METHOD_CALL                                         !0, 'addValue'
          9        SEND_VAL_EX                                              1
         10        DO_FCALL                                      0          
   26    11        INIT_FCALL                                               'var_export'
         12        FETCH_OBJ_R                                      ~7      !0, '_arr'
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                                 
   27    15        ECHO                                                     '%0A'
   29    16        INIT_METHOD_CALL                                         !0, 'addValue'
         17        SEND_VAL_EX                                              2
         18        DO_FCALL                                      0          
   30    19        INIT_FCALL                                               'var_export'
         20        FETCH_OBJ_R                                      ~10     !0, '_arr'
         21        SEND_VAL                                                 ~10
         22        DO_ICALL                                                 
   31    23        ECHO                                                     '%0A'
   33    24        INIT_METHOD_CALL                                         !0, 'addValue'
         25        SEND_VAL_EX                                              3
         26        SEND_VAL_EX                                              4
         27        DO_FCALL                                      0          
   34    28        INIT_FCALL                                               'var_export'
         29        FETCH_OBJ_R                                      ~13     !0, '_arr'
         30        SEND_VAL                                                 ~13
         31        DO_ICALL                                                 
   35    32        ECHO                                                     '%0A'
   37    33        INIT_METHOD_CALL                                         !0, 'addValue'
         34        SEND_VAL_EX                                              4
         35        SEND_VAL_EX                                              3
         36        DO_FCALL                                      0          
   38    37        INIT_FCALL                                               'var_export'
         38        FETCH_OBJ_R                                      ~16     !0, '_arr'
         39        SEND_VAL                                                 ~16
         40        DO_ICALL                                                 
   40    41        ECHO                                                     '%0A'
   42    42        INIT_METHOD_CALL                                         !0, 'addValue'
         43        SEND_VAL_EX                                              5
         44        DO_FCALL                                      0          
   43    45        INIT_FCALL                                               'var_export'
         46        FETCH_OBJ_R                                      ~19     !0, '_arr'
         47        SEND_VAL                                                 ~19
         48        DO_ICALL                                                 
         49      > RETURN                                                   1

Class SomeHelperClass:
Function addvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 13
Branch analysis from position: 27
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 13
Branch analysis from position: 27
Branch analysis from position: 13
filename:       /in/3rl23
function name:  addValue
number of ops:  28
compiled vars:  !0 = $value, !1 = $key, !2 = $i, !3 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    8     2        TYPE_CHECK                                  1020          !1
          3      > JMPZ                                                     ~4, ->8
    9     4    >   FETCH_OBJ_W                                      $5      '_arr'
          5        ASSIGN_DIM                                               $5, !1
          6        OP_DATA                                                  !0
    8     7      > JMP                                                      ->27
   11     8    >   ASSIGN                                                   !2, 0
          9        FETCH_OBJ_R                                      ~8      '_arr'
         10        COUNT                                            ~9      ~8
         11        ASSIGN                                                   !3, ~9
         12      > JMP                                                      ->25
   12    13    >   INIT_FCALL                                               'key_exists'
         14        SEND_VAR                                                 !2
         15        FETCH_OBJ_R                                      ~11     '_arr'
         16        SEND_VAL                                                 ~11
         17        DO_ICALL                                         $12     
         18        BOOL_NOT                                         ~13     $12
         19      > JMPZ                                                     ~13, ->24
   13    20    >   FETCH_OBJ_W                                      $14     '_arr'
         21        ASSIGN_DIM                                               $14, !2
         22        OP_DATA                                                  !0
   14    23      > JMP                                                      ->27
   11    24    >   PRE_INC                                                  !2
         25    >   IS_SMALLER_OR_EQUAL                                      !2, !3
         26      > JMPNZ                                                    ~17, ->13
   18    27    > > RETURN                                                   null

End of function addvalue

End of class SomeHelperClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.74 ms | 1004 KiB | 15 Q