3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'A/B/PA ID U/PA ID U/C/D'; // get only first value starting with PA: echo preg_match('~PA[^/]+~', $string, $match) ? $match[0] : ''; echo "\n---\n"; // get all values strings with PA: var_export(preg_match_all('~PA[^/]+~', $string, $matches) ? $matches[0] : []); echo "\n---\n"; // get all delimited values: var_export(explode('/', $string));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
Branch analysis from position: 23
filename:       /in/8nki6
function name:  (null)
number of ops:  35
compiled vars:  !0 = $string, !1 = $match, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'A%2FB%2FPA+ID+U%2FPA+ID+U%2FC%2FD'
    6     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%7EPA%5B%5E%2F%5D%2B%7E'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $4      
          6      > JMPZ                                                     $4, ->10
          7    >   FETCH_DIM_R                                      ~5      !1, 0
          8        QM_ASSIGN                                        ~6      ~5
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~6      ''
         11    >   ECHO                                                     ~6
    8    12        ECHO                                                     '%0A---%0A'
   11    13        INIT_FCALL                                               'var_export'
         14        INIT_FCALL                                               'preg_match_all'
         15        SEND_VAL                                                 '%7EPA%5B%5E%2F%5D%2B%7E'
         16        SEND_VAR                                                 !0
         17        SEND_REF                                                 !2
         18        DO_ICALL                                         $7      
         19      > JMPZ                                                     $7, ->23
         20    >   FETCH_DIM_R                                      ~8      !2, 0
         21        QM_ASSIGN                                        ~9      ~8
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~9      <array>
         24    >   SEND_VAL                                                 ~9
         25        DO_ICALL                                                 
   13    26        ECHO                                                     '%0A---%0A'
   16    27        INIT_FCALL                                               'var_export'
         28        INIT_FCALL                                               'explode'
         29        SEND_VAL                                                 '%2F'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $11     
         32        SEND_VAR                                                 $11
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
133.92 ms | 1002 KiB | 17 Q