3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calledURL(array $urls) { /** Changes array keys to its values and vice versa. */ { $tmp = array(); foreach ($variable as $key => $value) { $tmp[ trim($value, '/') ] = $key; } $urls = $tmp; } $url = parse_url($_SERVER["REQUEST_URI"])[ 'path' ]; $url = preg_match('~/([^/]+)/?$~', $url, $matches) ? $matches[ 1 ] : false; // also trim($s, '/') included if(! $url) { return -1; } return $urls[ $url ]; } echo calledURL([ 'receive', 'parse' ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pSija
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'calledurl'
          1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function calledurl:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 30
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 35
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 35
Branch analysis from position: 34
Branch analysis from position: 35
Branch analysis from position: 12
filename:       /in/pSija
function name:  calledURL
number of ops:  38
compiled vars:  !0 = $urls, !1 = $tmp, !2 = $variable, !3 = $value, !4 = $key, !5 = $url, !6 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, <array>
    8     2      > FE_RESET_R                                       $8      !2, ->12
          3    > > FE_FETCH_R                                       ~9      $8, !3, ->12
          4    >   ASSIGN                                                   !4, ~9
    9     5        INIT_FCALL                                               'trim'
          6        SEND_VAR                                                 !3
          7        SEND_VAL                                                 '%2F'
          8        DO_ICALL                                         $11     
          9        ASSIGN_DIM                                               !1, $11
         10        OP_DATA                                                  !4
    8    11      > JMP                                                      ->3
         12    >   FE_FREE                                                  $8
   12    13        ASSIGN                                                   !0, !1
   15    14        INIT_FCALL                                               'parse_url'
         15        FETCH_R                      global              ~14     '_SERVER'
         16        FETCH_DIM_R                                      ~15     ~14, 'REQUEST_URI'
         17        SEND_VAL                                                 ~15
         18        DO_ICALL                                         $16     
         19        FETCH_DIM_R                                      ~17     $16, 'path'
         20        ASSIGN                                                   !5, ~17
   16    21        INIT_FCALL                                               'preg_match'
         22        SEND_VAL                                                 '%7E%2F%28%5B%5E%2F%5D%2B%29%2F%3F%24%7E'
         23        SEND_VAR                                                 !5
         24        SEND_REF                                                 !6
         25        DO_ICALL                                         $19     
         26      > JMPZ                                                     $19, ->30
         27    >   FETCH_DIM_R                                      ~20     !6, 1
         28        QM_ASSIGN                                        ~21     ~20
         29      > JMP                                                      ->31
         30    >   QM_ASSIGN                                        ~21     <false>
         31    >   ASSIGN                                                   !5, ~21
   18    32        BOOL_NOT                                         ~23     !5
         33      > JMPZ                                                     ~23, ->35
   19    34    > > RETURN                                                   -1
   22    35    >   FETCH_DIM_R                                      ~24     !0, !5
         36      > RETURN                                                   ~24
   23    37*     > RETURN                                                   null

End of function calledurl

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.2 ms | 1403 KiB | 20 Q