3v4l.org

run code in 300+ PHP versions simultaneously
<?php $autocomplete = "BD/AL/ABC/01/18 job developper"; $q = "lol reference=BD/AL/ABC/ test"; $expr = '/reference=\w*/'; $words = explode(' ', $q); $newQ = ''; foreach ($words as $word) { if (preg_match($expr, $word, $matches)) { $reference = str_replace('reference=', '', $word); echo $reference; } else { $newQ = $newQ . ' ' . $word; } } echo $newQ;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 25
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/7llai
function name:  (null)
number of ops:  32
compiled vars:  !0 = $autocomplete, !1 = $q, !2 = $expr, !3 = $words, !4 = $newQ, !5 = $word, !6 = $matches, !7 = $reference
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'BD%2FAL%2FABC%2F01%2F18+job+developper'
    3     1        ASSIGN                                                   !1, 'lol+reference%3DBD%2FAL%2FABC%2F+test'
    4     2        ASSIGN                                                   !2, '%2Freference%3D%5Cw%2A%2F'
    6     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '+'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !3, $11
    7     8        ASSIGN                                                   !4, ''
    8     9      > FE_RESET_R                                       $14     !3, ->29
         10    > > FE_FETCH_R                                               $14, !5, ->29
    9    11    >   INIT_FCALL                                               'preg_match'
         12        SEND_VAR                                                 !2
         13        SEND_VAR                                                 !5
         14        SEND_REF                                                 !6
         15        DO_ICALL                                         $15     
         16      > JMPZ                                                     $15, ->25
   10    17    >   INIT_FCALL                                               'str_replace'
         18        SEND_VAL                                                 'reference%3D'
         19        SEND_VAL                                                 ''
         20        SEND_VAR                                                 !5
         21        DO_ICALL                                         $16     
         22        ASSIGN                                                   !7, $16
   11    23        ECHO                                                     !7
         24      > JMP                                                      ->28
   13    25    >   CONCAT                                           ~18     !4, '+'
         26        CONCAT                                           ~19     ~18, !5
         27        ASSIGN                                                   !4, ~19
    8    28    > > JMP                                                      ->10
         29    >   FE_FREE                                                  $14
   17    30        ECHO                                                     !4
   18    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.64 ms | 1396 KiB | 19 Q