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 ($urls as $key => $value) { $tmp[ trim($value, '/') ] = $key; } $urls = $tmp; } $url = parse_url("/parse")[ '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/eLmda
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 = 25, Position 2 = 28
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
Branch analysis from position: 33
Branch analysis from position: 12
filename:       /in/eLmda
function name:  calledURL
number of ops:  36
compiled vars:  !0 = $urls, !1 = $tmp, !2 = $value, !3 = $key, !4 = $url, !5 = $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                                       $7      !0, ->12
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->12
          4    >   ASSIGN                                                   !3, ~8
    9     5        INIT_FCALL                                               'trim'
          6        SEND_VAR                                                 !2
          7        SEND_VAL                                                 '%2F'
          8        DO_ICALL                                         $10     
          9        ASSIGN_DIM                                               !1, $10
         10        OP_DATA                                                  !3
    8    11      > JMP                                                      ->3
         12    >   FE_FREE                                                  $7
   12    13        ASSIGN                                                   !0, !1
   15    14        INIT_FCALL                                               'parse_url'
         15        SEND_VAL                                                 '%2Fparse'
         16        DO_ICALL                                         $13     
         17        FETCH_DIM_R                                      ~14     $13, 'path'
         18        ASSIGN                                                   !4, ~14
   16    19        INIT_FCALL                                               'preg_match'
         20        SEND_VAL                                                 '%7E%2F%28%5B%5E%2F%5D%2B%29%2F%3F%24%7E'
         21        SEND_VAR                                                 !4
         22        SEND_REF                                                 !5
         23        DO_ICALL                                         $16     
         24      > JMPZ                                                     $16, ->28
         25    >   FETCH_DIM_R                                      ~17     !5, 1
         26        QM_ASSIGN                                        ~18     ~17
         27      > JMP                                                      ->29
         28    >   QM_ASSIGN                                        ~18     <false>
         29    >   ASSIGN                                                   !4, ~18
   18    30        BOOL_NOT                                         ~20     !4
         31      > JMPZ                                                     ~20, ->33
   19    32    > > RETURN                                                   -1
   22    33    >   FETCH_DIM_R                                      ~21     !0, !4
         34      > RETURN                                                   ~21
   23    35*     > RETURN                                                   null

End of function calledurl

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.96 ms | 1403 KiB | 20 Q