3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LazyPool { private $connections = []; private $providers = []; public function addProvider($name, callable $provider) { $this->providers[$name] = $provider; return $this; } public function getConnection($name) { if ( array_key_exists($name, $this->connections) === false || $this->connections[$name] === null ) { $this->connections[$name] = call_user_func( $this->providers[$name] ); } return $this->connections[$name]; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yf4iV
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E > > RETURN                                                   1

Class LazyPool:
Function addprovider:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yf4iV
function name:  addProvider
number of ops:  8
compiled vars:  !0 = $name, !1 = $provider
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        FETCH_OBJ_W                                      $2      'providers'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   12     5        FETCH_THIS                                       ~4      
          6      > RETURN                                                   ~4
   13     7*     > RETURN                                                   null

End of function addprovider

Function getconnection:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 9
filename:       /in/Yf4iV
function name:  getConnection
number of ops:  21
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        FETCH_OBJ_R                                      ~1      'connections'
          2        ARRAY_KEY_EXISTS                                 ~2      !0, ~1
          3        TYPE_CHECK                                    4  ~3      ~2
          4      > JMPNZ_EX                                         ~3      ~3, ->9
          5    >   FETCH_OBJ_R                                      ~4      'connections'
          6        FETCH_DIM_R                                      ~5      ~4, !0
          7        TYPE_CHECK                                    2  ~6      ~5
          8        BOOL                                             ~3      ~6
          9    > > JMPZ                                                     ~3, ->17
   19    10    >   FETCH_OBJ_R                                      ~9      'providers'
         11        FETCH_DIM_R                                      ~10     ~9, !0
         12        INIT_USER_CALL                                0          'call_user_func', ~10
         13        DO_FCALL                                      0  $11     
         14        FETCH_OBJ_W                                      $7      'connections'
         15        ASSIGN_DIM                                               $7, !0
         16        OP_DATA                                                  $11
   21    17    >   FETCH_OBJ_R                                      ~12     'connections'
         18        FETCH_DIM_R                                      ~13     ~12, !0
         19      > RETURN                                                   ~13
   22    20*     > RETURN                                                   null

End of function getconnection

End of class LazyPool.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.83 ms | 1395 KiB | 13 Q