3v4l.org

run code in 300+ PHP versions simultaneously
<?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");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K1pnI
function name:  (null)
number of ops:  9
compiled vars:  !0 = $dog
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Dog'
          1        SEND_VAL_EX                                              'Rover'
          2        SEND_VAL_EX                                              'red'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   23     5        INIT_METHOD_CALL                                         !0, 'greet'
          6        SEND_VAL_EX                                              'Hello'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FK1pnI%3A15%240

Class Dog:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K1pnI
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K1pnI
function name:  greet
number of ops:  5
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%2FK1pnI%3A15%240'
          2        BIND_LEXICAL                                             ~1, !0
   18     3      > RETURN                                                   ~1
   19     4*     > RETURN                                                   null

End of function greet

End of class Dog.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.15 ms | 1399 KiB | 13 Q