3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class B { function va2() { return 22; } public $v3=19; function __construct() { $this->va = function() { return []; }; } } $o=new B; var_dump(($o->va)()); var_dump(($o['va'])()); var_dump($o['va']());
based on 56lZb
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gGbPe
function name:  (null)
number of ops:  23
compiled vars:  !0 = $o
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  17     1        NEW                                              $2      :-6
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $2
  18     4        INIT_FCALL                                               'var_dump'
         5        FETCH_OBJ_R                                      $5      !0, 'va'
         6        INIT_DYNAMIC_CALL                                        $5
         7        DO_FCALL                                      0  $6      
         8        SEND_VAR                                                 $6
         9        DO_ICALL                                                 
  19    10        INIT_FCALL                                               'var_dump'
        11        FETCH_DIM_R                                      $8      !0, 'va'
        12        INIT_DYNAMIC_CALL                                        $8
        13        DO_FCALL                                      0  $9      
        14        SEND_VAR                                                 $9
        15        DO_ICALL                                                 
  20    16        INIT_FCALL                                               'var_dump'
        17        FETCH_DIM_R                                      $11     !0, 'va'
        18        INIT_DYNAMIC_CALL                                        $11
        19        DO_FCALL                                      0  $12     
        20        SEND_VAR                                                 $12
        21        DO_ICALL                                                 
        22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FgGbPe0x7f1fbb68e0b9:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gGbPe
function name:  {closure}
number of ops:  2
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  12     0  E > > RETURN                                                   <array>
  13     1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FgGbPe0x7f1fbb68e0b9

Class B:
Function va2:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gGbPe
function name:  va2
number of ops:  2
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E > > RETURN                                                   22
   6     1*     > RETURN                                                   null

End of function va2

Function __construct:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gGbPe
function name:  __construct
number of ops:  4
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  11     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgGbPe0x7f1fbb68e0b9'
         1        ASSIGN_OBJ                                               'va'
  13     2        OP_DATA                                                  ~1
  14     3      > RETURN                                                   null

End of function __construct

End of class B.

Generated using Vulcan Logic Dumper, using php 7.3.0