3v4l.org

run code in 300+ PHP versions simultaneously
<?php $config = [ 'doctrine' => [ 'dbal' => [ 'default_connection' => 'default' , 'connections' => [ 'default' => [ 'driver' => "%database_driver%" , 'host' => "%database_host%" , 'port' => "%database_port%" , 'dbname' => "%database_name%" , 'user' => "%database_user%" , 'password' => "%database_password%" , 'charset' => 'UTF8' ] , 'special' => [ 'driver' => "%database_driver%" , 'host' => "%database_host%" , 'port' => "%database_port%" , 'dbname' => "%database_name_special%" , 'user' => "%database_user_special%" , 'password' => "%database_password_special%" , 'charset' => 'UTF8' ] ] ] , 'orm' => [ 'default_entity_manager' => 'default' , 'auto_generate_proxy_classes' => "%kernel.debug%" , 'entity_managers' => [ 'default' => [ 'connection' => 'default' , 'naming_strategy' => 'doctrine.orm.naming_strategy.underscore' , 'mappings' => [ 'AppBundle' => [ 'type' => 'yml' , 'dir' => 'Resources/config/doctrine' , 'alias' => 'AppBundle' ] ] ] ] ] ] , 'swiftmailer' => [ 'transport' => "%mailer_transport%" , 'host' => "%mailer_host%" , 'username' => "%mailer_user%" , 'password' => "%mailer_password%" , 'spool' => ['type' => 'memory' ] ] ]; var_dump($config['doctrine']['dbal']['default_connection']); $connection = &getKey($config, 'doctrine.dbal.default_connection'); $connection = 'special'; var_dump($config['doctrine']['dbal']['default_connection']); function &getKey(&$config, $path){ if (strpos($path, '.') !== false){ list($key, $path) = explode('.', $path, 2); return getKey($config[$key], $path); } else { return $config[$path]; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SGBpN
function name:  (null)
number of ops:  20
compiled vars:  !0 = $config, !1 = $connection
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   57     1        INIT_FCALL                                               'var_dump'
          2        FETCH_DIM_R                                      ~3      !0, 'doctrine'
          3        FETCH_DIM_R                                      ~4      ~3, 'dbal'
          4        FETCH_DIM_R                                      ~5      ~4, 'default_connection'
          5        SEND_VAL                                                 ~5
          6        DO_ICALL                                                 
   58     7        INIT_FCALL_BY_NAME                                       'getKey'
          8        SEND_VAR_EX                                              !0
          9        SEND_VAL_EX                                              'doctrine.dbal.default_connection'
         10        DO_FCALL                                      0  $7      
         11        ASSIGN_REF                                               !1, $7
   59    12        ASSIGN                                                   !1, 'special'
   60    13        INIT_FCALL                                               'var_dump'
         14        FETCH_DIM_R                                      ~10     !0, 'doctrine'
         15        FETCH_DIM_R                                      ~11     ~10, 'dbal'
         16        FETCH_DIM_R                                      ~12     ~11, 'default_connection'
         17        SEND_VAL                                                 ~12
         18        DO_ICALL                                                 
   69    19      > RETURN                                                   1

Function getkey:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
Return found
Branch analysis from position: 26
Return found
filename:       /in/SGBpN
function name:  getKey
number of ops:  29
compiled vars:  !0 = $config, !1 = $path, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   63     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '.'
          5        DO_ICALL                                         $3      
          6        TYPE_CHECK                                  1018          $3
          7      > JMPZ                                                     ~4, ->26
   64     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '.'
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 2
         12        DO_ICALL                                         $5      
         13        FETCH_LIST_R                                     $6      $5, 0
         14        ASSIGN                                                   !2, $6
         15        FETCH_LIST_R                                     $8      $5, 1
         16        ASSIGN                                                   !1, $8
         17        FREE                                                     $5
   65    18        INIT_FCALL_BY_NAME                                       'getKey'
         19        CHECK_FUNC_ARG                                           
         20        FETCH_DIM_FUNC_ARG                               $10     !0, !2
         21        SEND_FUNC_ARG                                            $10
         22        SEND_VAR_EX                                              !1
         23        DO_FCALL                                      0  $11     
         24      > RETURN_BY_REF                                            $11
   63    25*       JMP                                                      ->28
   67    26    >   FETCH_DIM_W                                      $12     !0, !1
         27      > RETURN_BY_REF                                            $12
   69    28*     > RETURN_BY_REF                                            null

End of function getkey

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
303.08 ms | 1017 KiB | 16 Q