3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { private $timeout = 0; public function expiresAfter($timeout) { $this->timeout = $timeout; } public function getTimeout() { return $this->timeout; } } class CacheHelper { static public function expiresAfter($time) { return function ($item) use ($time) { $item->expiresAfter($time); }; } } $item = new Item; (CacheHelper::expiresAfter(30))($item); echo $item->getTimeout();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eofqs
function name:  (null)
number of ops:  13
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'Item'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        INIT_STATIC_METHOD_CALL                                  'CacheHelper', 'expiresAfter'
          4        SEND_VAL                                                 30
          5        DO_FCALL                                      0  $4      
          6        INIT_DYNAMIC_CALL                                        $4
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   30     9        INIT_METHOD_CALL                                         !0, 'getTimeout'
         10        DO_FCALL                                      0  $6      
         11        ECHO                                                     $6
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FEofqs%3A22%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eofqs
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $item, !1 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   23     2        INIT_METHOD_CALL                                         !0, 'expiresAfter'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
   24     5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FEofqs%3A22%240

Class Item:
Function expiresafter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eofqs
function name:  expiresAfter
number of ops:  4
compiled vars:  !0 = $timeout
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'timeout'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function expiresafter

Function gettimeout:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eofqs
function name:  getTimeout
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'timeout'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function gettimeout

End of class Item.

Class CacheHelper:
Function expiresafter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eofqs
function name:  expiresAfter
number of ops:  5
compiled vars:  !0 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEofqs%3A22%240'
          2        BIND_LEXICAL                                             ~1, !0
   24     3      > RETURN                                                   ~1
   25     4*     > RETURN                                                   null

End of function expiresafter

End of class CacheHelper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.49 ms | 1399 KiB | 13 Q