3v4l.org

run code in 500+ PHP versions simultaneously
<?php //Create array of paths --example from your path ***use right paths***; $path = array( 'SITE_ROOT' => $_SERVER['DOCUMENT_ROOT'], 'CORE_PATH' => '/core', 'INCLUDE_PATH' => '/inc', 'LAYOUT_PATH' => '/layout', 'BLOCK_PATH' => '/blocks', 'STATIC_PATH' => '/static' ); //usage: createPath( $path ); //Testiing echo SITE_ROOT; function createPath( $path ) { if( empty( $path ) ) { die("Array of path required!"); } foreach( $path as $constant => $path ) { if(!defined( strtoupper($constant) ) ) { define( strtoupper($constant), $path . '/'); } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K6VZF
function name:  (null)
number of ops:  15
compiled vars:  !0 = $path
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   FETCH_R                          global              ~1      '_SERVER'
          1        FETCH_DIM_R                                          ~2      ~1, 'DOCUMENT_ROOT'
          2        INIT_ARRAY                                           ~3      ~2, 'SITE_ROOT'
    5     3        ADD_ARRAY_ELEMENT                                    ~3      '%2Fcore', 'CORE_PATH'
    6     4        ADD_ARRAY_ELEMENT                                    ~3      '%2Finc', 'INCLUDE_PATH'
    7     5        ADD_ARRAY_ELEMENT                                    ~3      '%2Flayout', 'LAYOUT_PATH'
    8     6        ADD_ARRAY_ELEMENT                                    ~3      '%2Fblocks', 'BLOCK_PATH'
    9     7        ADD_ARRAY_ELEMENT                                    ~3      '%2Fstatic', 'STATIC_PATH'
    3     8        ASSIGN                                                       !0, ~3
   13     9        INIT_FCALL_BY_NAME                                           'createPath'
         10        SEND_VAR_EX                                                  !0
         11        DO_FCALL                                          0          
   16    12        FETCH_CONSTANT                                       ~6      'SITE_ROOT'
         13        ECHO                                                         ~6
   31    14      > RETURN                                                       1

Function createpath:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 61) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 26
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 26
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/K6VZF
function name:  createPath
number of ops:  28
compiled vars:  !0 = $path, !1 = $constant
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
   20     1        ISSET_ISEMPTY_CV                                             !0
          2      > JMPZ                                                         ~2, ->6
   22     3    > > INIT_FCALL                                                   'exit'
          4*       SEND_VAL                                                     'Array+of+path+required%21'
          5*       DO_ICALL                                                     
   24     6    > > FE_RESET_R                                           $4      !0, ->26
          7    > > FE_FETCH_R                                           ~5      $4, !0, ->26
          8    >   ASSIGN                                                       !1, ~5
   26     9        INIT_FCALL                                                   'defined'
         10        INIT_FCALL                                                   'strtoupper'
         11        SEND_VAR                                                     !1
         12        DO_ICALL                                             $7      
         13        SEND_VAR                                                     $7
         14        DO_ICALL                                             $8      
         15        BOOL_NOT                                             ~9      $8
         16      > JMPZ                                                         ~9, ->25
   28    17    >   INIT_FCALL                                                   'define'
         18        INIT_FCALL                                                   'strtoupper'
         19        SEND_VAR                                                     !1
         20        DO_ICALL                                             $10     
         21        SEND_VAR                                                     $10
         22        CONCAT                                               ~11     !0, '%2F'
         23        SEND_VAL                                                     ~11
         24        DO_ICALL                                                     
   24    25    > > JMP                                                          ->7
         26    >   FE_FREE                                                      $4
   31    27      > RETURN                                                       null

End of function createpath

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.4 ms | 2606 KiB | 17 Q