3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $a; public $b; private $c; public function __construct($a, $b, $c) { $this->a = $a; $this->b = $b; $this->c = $c; } public function toArray() { return $this->getVars(); } public function getVars() { $ret = array_filter((array)$this); $c = get_class($this); $cn = strlen($c); foreach ($ret as $k => $v) { if (0 === strncmp($k, $c, $cn)) { unset($ret[$k]); } } return $ret; } } $o = new A(1,2,3); var_dump($o->toArray());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jl6Co
function name:  (null)
number of ops:  12
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'A'
          1        SEND_VAL_EX                                              1
          2        SEND_VAL_EX                                              2
          3        SEND_VAL_EX                                              3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   29     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'toArray'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jl6Co
function name:  __construct
number of ops:  10
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    8     3        ASSIGN_OBJ                                               'a'
          4        OP_DATA                                                  !0
    9     5        ASSIGN_OBJ                                               'b'
          6        OP_DATA                                                  !1
   10     7        ASSIGN_OBJ                                               'c'
          8        OP_DATA                                                  !2
   11     9      > RETURN                                                   null

End of function __construct

Function toarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jl6Co
function name:  toArray
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_METHOD_CALL                                         'getVars'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   14     3*     > RETURN                                                   null

End of function toarray

Function getvars:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/Jl6Co
function name:  getVars
number of ops:  26
compiled vars:  !0 = $ret, !1 = $c, !2 = $cn, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'array_filter'
          1        FETCH_THIS                                       ~5      
          2        CAST                                          7  ~6      ~5
          3        SEND_VAL                                                 ~6
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !0, $7
   17     6        FETCH_THIS                                       ~9      
          7        GET_CLASS                                        ~10     ~9
          8        ASSIGN                                                   !1, ~10
   18     9        STRLEN                                           ~12     !1
         10        ASSIGN                                                   !2, ~12
   19    11      > FE_RESET_R                                       $14     !0, ->23
         12    > > FE_FETCH_R                                       ~15     $14, !3, ->23
         13    >   ASSIGN                                                   !4, ~15
   20    14        INIT_FCALL                                               'strncmp'
         15        SEND_VAR                                                 !4
         16        SEND_VAR                                                 !1
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $17     
         19        IS_IDENTICAL                                             $17, 0
         20      > JMPZ                                                     ~18, ->22
   21    21    >   UNSET_DIM                                                !0, !4
   19    22    > > JMP                                                      ->12
         23    >   FE_FREE                                                  $14
   24    24      > RETURN                                                   !0
   25    25*     > RETURN                                                   null

End of function getvars

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.45 ms | 1400 KiB | 19 Q