3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Se { public $data1; public function setData(array $data) { if (empty($data)) { throw new InvalidArgumentException('The name of an employee cannot be empty.'); } $this->data1 = array_values($data); //you error was here, no need to to assign $data twice so I deleted top line. } public function getE() { return $this->data1[0]; } } $tmpaaa = array('3333','222'); $ttt = new Se(); $ttt->setData($tmpaaa); echo $ttt->getE();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bGciS
function name:  (null)
number of ops:  11
compiled vars:  !0 = $tmpaaa, !1 = $ttt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   ASSIGN                                                   !0, <array>
   25     1        NEW                                              $3      'Se'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   26     4        INIT_METHOD_CALL                                         !1, 'setData'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   28     7        INIT_METHOD_CALL                                         !1, 'getE'
          8        DO_FCALL                                      0  $7      
          9        ECHO                                                     $7
         10      > RETURN                                                   1

Class Se:
Function setdata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bGciS
function name:  setData
number of ops:  13
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ISSET_ISEMPTY_CV                                         !0
          2      > JMPZ                                                     ~1, ->7
   10     3    >   NEW                                              $2      'InvalidArgumentException'
          4        SEND_VAL_EX                                              'The+name+of+an+employee+cannot+be+empty.'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
   13     7    >   INIT_FCALL                                               'array_values'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        ASSIGN_OBJ                                               'data1'
         11        OP_DATA                                                  $5
   14    12      > RETURN                                                   null

End of function setdata

Function gete:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bGciS
function name:  getE
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'data1'
          1        FETCH_DIM_R                                      ~1      ~0, 0
          2      > RETURN                                                   ~1
   21     3*     > RETURN                                                   null

End of function gete

End of class Se.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.17 ms | 1388 KiB | 15 Q