3v4l.org

run code in 300+ PHP versions simultaneously
<?php use Closure; class Shared { public function share(Closure $closure) { return function($container) use ($closure) { // We'll simply declare a static variable within the Closures and if it has // not been set we will execute the given Closures to resolve this value // and return it back to these consumers of the method as an instance static $object; if(is_null($object)) { $object = $closure($container); } return $object; }; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d3279
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fd3279%3A8%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/d3279
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $container, !1 = $closure, !2 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   12     2        BIND_STATIC                                              !2
   14     3        TYPE_CHECK                                    2          !2
          4      > JMPZ                                                     ~3, ->9
   15     5    >   INIT_DYNAMIC_CALL                                        !1
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $4      
          8        ASSIGN                                                   !2, $4
   18     9    > > RETURN                                                   !2
   19    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fd3279%3A8%240

Class Shared:
Function share:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d3279
function name:  share
number of ops:  5
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fd3279%3A8%240'
          2        BIND_LEXICAL                                             ~1, !0
   19     3      > RETURN                                                   ~1
   20     4*     > RETURN                                                   null

End of function share

End of class Shared.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.43 ms | 1394 KiB | 13 Q