3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $x; private $y; public function __construct() { $this->x = 10; $this->y = function (){ return $this->getToutesLesCommandes();}; } public function getY($k) { return $this->$k; } public function getToutesLesCommandes() { //sleep(5); echo "Et 5 tres longues secondes plus tard..."; return array('commande1' => 123456, 'commande2' => 456789); } } $t = new Test(); //var_dump($t); var_dump($t->getY()); var_dump($t->getY());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iZQF5
function name:  (null)
number of ops:  14
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   30     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getY'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   31     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'getY'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FiZQF5%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iZQF5
function name:  {closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_THIS                                       $0      
          1        INIT_METHOD_CALL                                         $0, 'getToutesLesCommandes'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FiZQF5%3A11%240

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iZQF5
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN_OBJ                                               'x'
          1        OP_DATA                                                  10
   11     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FiZQF5%3A11%240'
          3        ASSIGN_OBJ                                               'y'
          4        OP_DATA                                                  ~2
   12     5      > RETURN                                                   null

End of function __construct

Function gety:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iZQF5
function name:  getY
number of ops:  4
compiled vars:  !0 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        FETCH_OBJ_R                                      ~1      !0
          2      > RETURN                                                   ~1
   17     3*     > RETURN                                                   null

End of function gety

Function gettouteslescommandes:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iZQF5
function name:  getToutesLesCommandes
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ECHO                                                     'Et+5+tres+longues+secondes+plus+tard...'
   23     1      > RETURN                                                   <array>
   24     2*     > RETURN                                                   null

End of function gettouteslescommandes

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.5 ms | 1400 KiB | 15 Q