3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = ''; /** @var non-empty-string|null $s */ function take_non_empty_string_or_null(?string $s): void { echo (string) $s; } function take_any_string(string $s): void { echo $s; } function take_an_int_or_null(?int $s): void { echo (int) $s; } /** * @param array{path: string} $arr */ function take_url(array $arr): void { foreach($arr as $v) { if (null !== $v) { take_any_string($v); } } } var_dump(parse_url($url)); // array{} take_non_empty_string_or_null(parse_url($url, PHP_URL_SCHEME)); // null|non-empty-string take_non_empty_string_or_null(parse_url($url, PHP_URL_USER)); // null|non-empty-string take_non_empty_string_or_null(parse_url($url, PHP_URL_PASS)); // null|non-empty-string take_non_empty_string_or_null(parse_url($url, PHP_URL_HOST)); // null|non-empty-string take_an_int_or_null(parse_url($url, PHP_URL_PORT)); // null|int take_any_string(parse_url($url, PHP_URL_PORT)); // string take_non_empty_string_or_null(parse_url($url, PHP_URL_PATH)); // null|non-empty-string take_non_empty_string_or_null(parse_url($url, PHP_URL_QUERY)); // null|non-empty-string take_non_empty_string_or_null(parse_url($url, PHP_URL_FRAGMENT)); // null|non-empty-string
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KIeQB
function name:  (null)
number of ops:  71
compiled vars:  !0 = $url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, ''
   29     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'parse_url'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
   30     7        INIT_FCALL                                               'take_non_empty_string_or_null'
          8        INIT_FCALL                                               'parse_url'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 0
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        DO_FCALL                                      0          
   31    14        INIT_FCALL                                               'take_non_empty_string_or_null'
         15        INIT_FCALL                                               'parse_url'
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 3
         18        DO_ICALL                                         $6      
         19        SEND_VAR                                                 $6
         20        DO_FCALL                                      0          
   32    21        INIT_FCALL                                               'take_non_empty_string_or_null'
         22        INIT_FCALL                                               'parse_url'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 4
         25        DO_ICALL                                         $8      
         26        SEND_VAR                                                 $8
         27        DO_FCALL                                      0          
   33    28        INIT_FCALL                                               'take_non_empty_string_or_null'
         29        INIT_FCALL                                               'parse_url'
         30        SEND_VAR                                                 !0
         31        SEND_VAL                                                 1
         32        DO_ICALL                                         $10     
         33        SEND_VAR                                                 $10
         34        DO_FCALL                                      0          
   34    35        INIT_FCALL                                               'take_an_int_or_null'
         36        INIT_FCALL                                               'parse_url'
         37        SEND_VAR                                                 !0
         38        SEND_VAL                                                 2
         39        DO_ICALL                                         $12     
         40        SEND_VAR                                                 $12
         41        DO_FCALL                                      0          
   35    42        INIT_FCALL                                               'take_any_string'
         43        INIT_FCALL                                               'parse_url'
         44        SEND_VAR                                                 !0
         45        SEND_VAL                                                 2
         46        DO_ICALL                                         $14     
         47        SEND_VAR                                                 $14
         48        DO_FCALL                                      0          
   36    49        INIT_FCALL                                               'take_non_empty_string_or_null'
         50        INIT_FCALL                                               'parse_url'
         51        SEND_VAR                                                 !0
         52        SEND_VAL                                                 5
         53        DO_ICALL                                         $16     
         54        SEND_VAR                                                 $16
         55        DO_FCALL                                      0          
   37    56        INIT_FCALL                                               'take_non_empty_string_or_null'
         57        INIT_FCALL                                               'parse_url'
         58        SEND_VAR                                                 !0
         59        SEND_VAL                                                 6
         60        DO_ICALL                                         $18     
         61        SEND_VAR                                                 $18
         62        DO_FCALL                                      0          
   38    63        INIT_FCALL                                               'take_non_empty_string_or_null'
         64        INIT_FCALL                                               'parse_url'
         65        SEND_VAR                                                 !0
         66        SEND_VAL                                                 7
         67        DO_ICALL                                         $20     
         68        SEND_VAR                                                 $20
         69        DO_FCALL                                      0          
         70      > RETURN                                                   1

Function take_non_empty_string_or_null:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KIeQB
function name:  take_non_empty_string_or_null
number of ops:  4
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        CAST                                          6  ~1      !0
          2        ECHO                                                     ~1
    8     3      > RETURN                                                   null

End of function take_non_empty_string_or_null

Function take_any_string:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KIeQB
function name:  take_any_string
number of ops:  3
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ECHO                                                     !0
   12     2      > RETURN                                                   null

End of function take_any_string

Function take_an_int_or_null:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KIeQB
function name:  take_an_int_or_null
number of ops:  4
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        CAST                                          4  ~1      !0
          2        ECHO                                                     ~1
   16     3      > RETURN                                                   null

End of function take_an_int_or_null

Function take_url:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 8
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/KIeQB
function name:  take_url
number of ops:  11
compiled vars:  !0 = $arr, !1 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1      > FE_RESET_R                                       $2      !0, ->9
          2    > > FE_FETCH_R                                               $2, !1, ->9
   23     3    >   TYPE_CHECK                                  1020          !1
          4      > JMPZ                                                     ~3, ->8
   24     5    >   INIT_FCALL                                               'take_any_string'
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0          
   22     8    > > JMP                                                      ->2
          9    >   FE_FREE                                                  $2
   27    10      > RETURN                                                   null

End of function take_url

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.91 ms | 1022 KiB | 25 Q