3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_shortcode_regex( $tagnames = null ) { global $shortcode_tags; if ( empty( $tagnames ) ) { $tagnames = array_keys( $shortcode_tags ); } $tagregexp = join( '|', array_map('preg_quote', $tagnames) ); // WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag() // Also, see shortcode_unautop() and shortcode.js. return '\\[' // Opening bracket . '(\\[?)' // 1: Optional second opening bracket for escaping shortcodes: [[tag]] . "($tagregexp)" // 2: Shortcode name . '(?![\\w-])' // Not followed by word character or hyphen . '(' // 3: Unroll the loop: Inside the opening shortcode tag . '[^\\]\\/]*' // Not a closing bracket or forward slash . '(?:' . '\\/(?!\\])' // A forward slash not followed by a closing bracket . '[^\\]\\/]*' // Not a closing bracket or forward slash . ')*?' . ')' . '(?:' . '(\\/)' // 4: Self closing tag ... . '\\]' // ... and closing bracket . '|' . '\\]' // Closing bracket . '(?:' . '(' // 5: Unroll the loop: Optionally, anything between the opening and closing shortcode tags . '[^\\[]*+' // Not an opening bracket . '(?:' . '\\[(?!\\/\\2\\])' // An opening bracket not followed by the closing shortcode tag . '[^\\[]*+' // Not an opening bracket . ')*+' . ')' . '\\[\\/\\2\\]' // Closing shortcode tag . ')?' . ')' . '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]] } function shortcode_parse_atts($text) { $atts = array(); $pattern = get_shortcode_atts_regex(['audio']); $text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text); if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) { foreach ($match as $m) { if (!empty($m[1])) $atts[strtolower($m[1])] = stripcslashes($m[2]); elseif (!empty($m[3])) $atts[strtolower($m[3])] = stripcslashes($m[4]); elseif (!empty($m[5])) $atts[strtolower($m[5])] = stripcslashes($m[6]); elseif (isset($m[7]) && strlen($m[7])) $atts[] = stripcslashes($m[7]); elseif (isset($m[8])) $atts[] = stripcslashes($m[8]); } // Reject any unclosed HTML elements foreach( $atts as &$value ) { if ( false !== strpos( $value, '<' ) ) { if ( 1 !== preg_match( '/^[^<]*+(?:<[^>]*+>[^<]*+)*+$/', $value ) ) { $value = ''; } } } } else { $atts = ltrim($text); } return $atts; } var_dump(shortcode_parse_atts(':http://localhost:8888/lusa/audio/1310seg02.mp3'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OmtRc
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   75     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'shortcode_parse_atts'
          2        SEND_VAL                                                 '%3Ahttp%3A%2F%2Flocalhost%3A8888%2Flusa%2Faudio%2F1310seg02.mp3'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function get_shortcode_regex:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/OmtRc
function name:  get_shortcode_regex
number of ops:  48
compiled vars:  !0 = $tagnames, !1 = $shortcode_tags, !2 = $tagregexp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      null
    3     1        BIND_GLOBAL                                              !1, 'shortcode_tags'
    5     2        ISSET_ISEMPTY_CV                                         !0
          3      > JMPZ                                                     ~3, ->8
    6     4    >   INIT_FCALL                                               'array_keys'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !0, $4
    8     8    >   INIT_FCALL                                               'join'
          9        SEND_VAL                                                 '%7C'
         10        INIT_FCALL                                               'array_map'
         11        SEND_VAL                                                 'preg_quote'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                         $7      
         16        ASSIGN                                                   !2, $7
   15    17        ROPE_INIT                                     3  ~10     '%28'
         18        ROPE_ADD                                      1  ~10     ~10, !2
         19        ROPE_END                                      2  ~9      ~10, '%29'
         20        CONCAT                                           ~12     '%5C%5B%28%5C%5B%3F%29', ~9
   16    21        CONCAT                                           ~13     ~12, '%28%3F%21%5B%5Cw-%5D%29'
   17    22        CONCAT                                           ~14     ~13, '%28'
   18    23        CONCAT                                           ~15     ~14, '%5B%5E%5C%5D%5C%2F%5D%2A'
   19    24        CONCAT                                           ~16     ~15, '%28%3F%3A'
   20    25        CONCAT                                           ~17     ~16, '%5C%2F%28%3F%21%5C%5D%29'
   21    26        CONCAT                                           ~18     ~17, '%5B%5E%5C%5D%5C%2F%5D%2A'
   22    27        CONCAT                                           ~19     ~18, '%29%2A%3F'
   23    28        CONCAT                                           ~20     ~19, '%29'
   24    29        CONCAT                                           ~21     ~20, '%28%3F%3A'
   25    30        CONCAT                                           ~22     ~21, '%28%5C%2F%29'
   26    31        CONCAT                                           ~23     ~22, '%5C%5D'
   27    32        CONCAT                                           ~24     ~23, '%7C'
   28    33        CONCAT                                           ~25     ~24, '%5C%5D'
   29    34        CONCAT                                           ~26     ~25, '%28%3F%3A'
   30    35        CONCAT                                           ~27     ~26, '%28'
   31    36        CONCAT                                           ~28     ~27, '%5B%5E%5C%5B%5D%2A%2B'
   32    37        CONCAT                                           ~29     ~28, '%28%3F%3A'
   33    38        CONCAT                                           ~30     ~29, '%5C%5B%28%3F%21%5C%2F%5C2%5C%5D%29'
   34    39        CONCAT                                           ~31     ~30, '%5B%5E%5C%5B%5D%2A%2B'
   35    40        CONCAT                                           ~32     ~31, '%29%2A%2B'
   36    41        CONCAT                                           ~33     ~32, '%29'
   37    42        CONCAT                                           ~34     ~33, '%5C%5B%5C%2F%5C2%5C%5D'
   38    43        CONCAT                                           ~35     ~34, '%29%3F'
   39    44        CONCAT                                           ~36     ~35, '%29'
   40    45        CONCAT                                           ~37     ~36, '%28%5C%5D%3F%29'
         46      > RETURN                                                   ~37
   41    47*     > RETURN                                                   null

End of function get_shortcode_regex

Function shortcode_parse_atts:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 104
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 85
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 85
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 35
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 49
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 63
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 63
2 jumps found. (Code = 46) Position 1 = 65, Position 2 = 68
Branch analysis from position: 65
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 76
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 84
Branch analysis from position: 84
Branch analysis from position: 76
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 84
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 84
Branch analysis from position: 68
Branch analysis from position: 85
2 jumps found. (Code = 125) Position 1 = 87, Position 2 = 102
Branch analysis from position: 87
2 jumps found. (Code = 126) Position 1 = 88, Position 2 = 102
Branch analysis from position: 88
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 101
Branch analysis from position: 94
2 jumps found. (Code = 43) Position 1 = 100, Position 2 = 101
Branch analysis from position: 100
1 jumps found. (Code = 42) Position 1 = 87
Branch analysis from position: 87
Branch analysis from position: 101
Branch analysis from position: 101
Branch analysis from position: 102
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 102
Branch analysis from position: 85
Branch analysis from position: 104
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OmtRc
function name:  shortcode_parse_atts
number of ops:  110
compiled vars:  !0 = $text, !1 = $atts, !2 = $pattern, !3 = $match, !4 = $m, !5 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
   44     1        ASSIGN                                                   !1, <array>
   45     2        INIT_FCALL_BY_NAME                                       'get_shortcode_atts_regex'
          3        SEND_VAL_EX                                              <array>
          4        DO_FCALL                                      0  $7      
          5        ASSIGN                                                   !2, $7
   46     6        INIT_FCALL                                               'preg_replace'
          7        SEND_VAL                                                 '%2F%5B%5Cx%7B00a0%7D%5Cx%7B200b%7D%5D%2B%2Fu'
          8        SEND_VAL                                                 '+'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !0, $9
   47    12        INIT_FCALL                                               'preg_match_all'
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !0
         15        SEND_REF                                                 !3
         16        SEND_VAL                                                 2
         17        DO_ICALL                                         $11     
         18      > JMPZ                                                     $11, ->104
   48    19    > > FE_RESET_R                                       $12     !3, ->85
         20    > > FE_FETCH_R                                               $12, !4, ->85
   49    21    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~13     !4, 1
         22        BOOL_NOT                                         ~14     ~13
         23      > JMPZ                                                     ~14, ->35
   50    24    >   INIT_FCALL                                               'strtolower'
         25        FETCH_DIM_R                                      ~15     !4, 1
         26        SEND_VAL                                                 ~15
         27        DO_ICALL                                         $16     
         28        INIT_FCALL                                               'stripcslashes'
         29        FETCH_DIM_R                                      ~18     !4, 2
         30        SEND_VAL                                                 ~18
         31        DO_ICALL                                         $19     
         32        ASSIGN_DIM                                               !1, $16
         33        OP_DATA                                                  $19
         34      > JMP                                                      ->84
   51    35    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~20     !4, 3
         36        BOOL_NOT                                         ~21     ~20
         37      > JMPZ                                                     ~21, ->49
   52    38    >   INIT_FCALL                                               'strtolower'
         39        FETCH_DIM_R                                      ~22     !4, 3
         40        SEND_VAL                                                 ~22
         41        DO_ICALL                                         $23     
         42        INIT_FCALL                                               'stripcslashes'
         43        FETCH_DIM_R                                      ~25     !4, 4
         44        SEND_VAL                                                 ~25
         45        DO_ICALL                                         $26     
         46        ASSIGN_DIM                                               !1, $23
         47        OP_DATA                                                  $26
         48      > JMP                                                      ->84
   53    49    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~27     !4, 5
         50        BOOL_NOT                                         ~28     ~27
         51      > JMPZ                                                     ~28, ->63
   54    52    >   INIT_FCALL                                               'strtolower'
         53        FETCH_DIM_R                                      ~29     !4, 5
         54        SEND_VAL                                                 ~29
         55        DO_ICALL                                         $30     
         56        INIT_FCALL                                               'stripcslashes'
         57        FETCH_DIM_R                                      ~32     !4, 6
         58        SEND_VAL                                                 ~32
         59        DO_ICALL                                         $33     
         60        ASSIGN_DIM                                               !1, $30
         61        OP_DATA                                                  $33
         62      > JMP                                                      ->84
   55    63    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~34     !4, 7
         64      > JMPZ_EX                                          ~34     ~34, ->68
         65    >   FETCH_DIM_R                                      ~35     !4, 7
         66        STRLEN                                           ~36     ~35
         67        BOOL                                             ~34     ~36
         68    > > JMPZ                                                     ~34, ->76
   56    69    >   INIT_FCALL                                               'stripcslashes'
         70        FETCH_DIM_R                                      ~38     !4, 7
         71        SEND_VAL                                                 ~38
         72        DO_ICALL                                         $39     
         73        ASSIGN_DIM                                               !1
         74        OP_DATA                                                  $39
         75      > JMP                                                      ->84
   57    76    >   ISSET_ISEMPTY_DIM_OBJ                         0          !4, 8
         77      > JMPZ                                                     ~40, ->84
   58    78    >   INIT_FCALL                                               'stripcslashes'
         79        FETCH_DIM_R                                      ~42     !4, 8
         80        SEND_VAL                                                 ~42
         81        DO_ICALL                                         $43     
         82        ASSIGN_DIM                                               !1
         83        OP_DATA                                                  $43
   48    84    > > JMP                                                      ->20
         85    >   FE_FREE                                                  $12
   62    86      > FE_RESET_RW                                      $44     !1, ->102
         87    > > FE_FETCH_RW                                              $44, !5, ->102
   63    88    >   INIT_FCALL                                               'strpos'
         89        SEND_VAR                                                 !5
         90        SEND_VAL                                                 '%3C'
         91        DO_ICALL                                         $45     
         92        TYPE_CHECK                                  1018          $45
         93      > JMPZ                                                     ~46, ->101
   64    94    >   INIT_FCALL                                               'preg_match'
         95        SEND_VAL                                                 '%2F%5E%5B%5E%3C%5D%2A%2B%28%3F%3A%3C%5B%5E%3E%5D%2A%2B%3E%5B%5E%3C%5D%2A%2B%29%2A%2B%24%2F'
         96        SEND_VAR                                                 !5
         97        DO_ICALL                                         $47     
         98        IS_NOT_IDENTICAL                                         $47, 1
         99      > JMPZ                                                     ~48, ->101
   65   100    >   ASSIGN                                                   !5, ''
   62   101    > > JMP                                                      ->87
        102    >   FE_FREE                                                  $44
        103      > JMP                                                      ->108
   70   104    >   INIT_FCALL                                               'ltrim'
        105        SEND_VAR                                                 !0
        106        DO_ICALL                                         $50     
        107        ASSIGN                                                   !1, $50
   72   108    > > RETURN                                                   !1
   73   109*     > RETURN                                                   null

End of function shortcode_parse_atts

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.73 ms | 1415 KiB | 36 Q