3v4l.org

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

End of function addvalue

End of class SomeHelperClass.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
174.85 ms | 1802 KiB | 14 Q