3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Dog { private $_name; protected $_color; public function __construct($name, $color) { $this->_name = $name; $this->_color = $color; } public function greet($greeting) { return function() use ($greeting) { echo "$greeting, I am a {$this->_color} dog named {$this->_name}."; }; } } $dog = new Dog("Rover","red"); $dog->greet("Hello")();
based on K1pnI
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/D3lUk
function name:  (null)
number of ops:  12
compiled vars:  !0 = $dog
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
  22     1        NEW                                              $2      :-6
         2        SEND_VAL_EX                                              'Rover'
         3        SEND_VAL_EX                                              'red'
         4        DO_FCALL                                      0          
         5        ASSIGN                                                   !0, $2
  23     6        INIT_METHOD_CALL                                         !0, 'greet'
         7        SEND_VAL_EX                                              'Hello'
         8        DO_FCALL                                      0  $5      
         9        INIT_DYNAMIC_CALL                                        $5
        10        DO_FCALL                                      0          
        11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FD3lUk0x7f0455f1416d:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/D3lUk
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $greeting
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   FETCH_R                      static              $1      'greeting'
         1        ASSIGN                                                   !0, $1
  16     2        ROPE_INIT                                     6  ~6      !0
         3        FETCH_OBJ_R                                      $3      '_color'
         4        ROPE_ADD                                      1  ~6      ~6, '%2C+I+am+a+'
         5        ROPE_ADD                                      2  ~6      ~6, $3
  17     6        FETCH_OBJ_R                                      $4      '_name'
         7        ROPE_ADD                                      3  ~6      ~6, '+dog+named+%0A'
         8        ROPE_ADD                                      4  ~6      ~6, $4
         9        ROPE_END                                      5  ~5      ~6, '.'
        10        ECHO                                                     ~5
  18    11      > RETURN                                                   null

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

Class Dog:
Function __construct:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/D3lUk
function name:  __construct
number of ops:  7
compiled vars:  !0 = $name, !1 = $color
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   7     0  E >   RECV                                             !0      
         1        RECV                                             !1      
   9     2        ASSIGN_OBJ                                               '_name'
         3        OP_DATA                                                  !0
  10     4        ASSIGN_OBJ                                               '_color'
         5        OP_DATA                                                  !1
  11     6      > RETURN                                                   null

End of function __construct

Function greet:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/D3lUk
function name:  greet
number of ops:  4
compiled vars:  !0 = $greeting
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  13     0  E >   RECV                                             !0      
  15     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FD3lUk0x7f0455f1416d'
  18     2      > RETURN                                                   ~1
  19     3*     > RETURN                                                   null

End of function greet

End of class Dog.

Generated using Vulcan Logic Dumper, using php 7.3.0