3v4l.org

run code in 300+ 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 = 4
Branch analysis from position: 3
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 24
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 23
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/K6VZF
function name:  createPath
number of ops:  26
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, ->4
   22     3    > > EXIT                                                     'Array+of+path+required%21'
   24     4    > > FE_RESET_R                                       $3      !0, ->24
          5    > > FE_FETCH_R                                       ~4      $3, !0, ->24
          6    >   ASSIGN                                                   !1, ~4
   26     7        INIT_FCALL                                               'defined'
          8        INIT_FCALL                                               'strtoupper'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                         $7      
         13        BOOL_NOT                                         ~8      $7
         14      > JMPZ                                                     ~8, ->23
   28    15    >   INIT_FCALL                                               'define'
         16        INIT_FCALL                                               'strtoupper'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $9      
         19        SEND_VAR                                                 $9
         20        CONCAT                                           ~10     !0, '%2F'
         21        SEND_VAL                                                 ~10
         22        DO_ICALL                                                 
   24    23    > > JMP                                                      ->5
         24    >   FE_FREE                                                  $3
   31    25      > RETURN                                                   null

End of function createpath

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.07 ms | 1009 KiB | 16 Q