3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input_string = "Last time it rained was on 07/25/2013 and today is 08/09/2013."; if(preg_match_all("/\d{2}\/\d{2}\/\d{4}/", $input_string, $match)) { $replacements =array(); foreach ($match as $m) { foreach($m as $i){ $i = '/'.implode('\/',explode('/',$i)) . '/'; } } //$match[0][0] = '/'.implode('\/',explode('/',$match[0][0])) . '/'; //$match[0][1] = '/'.implode('\/',explode('/',$match[0][1])) . '/'; print_r($match); $replacements[0] = 'test1'; $replacements[1] = 'test2'; echo preg_replace($match[0], $replacements, $input_string); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 41
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 26
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 26
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 24
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 24
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 24
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 41
filename:       /in/19h4l
function name:  (null)
number of ops:  42
compiled vars:  !0 = $input_string, !1 = $match, !2 = $replacements, !3 = $m, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Last+time+it+rained+was+on+07%2F25%2F2013+and+today+is+08%2F09%2F2013.'
    3     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%5Cd%7B2%7D%5C%2F%5Cd%7B2%7D%5C%2F%5Cd%7B4%7D%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $6      
          6      > JMPZ                                                     $6, ->41
    5     7    >   ASSIGN                                                   !2, <array>
    6     8      > FE_RESET_R                                       $8      !1, ->26
          9    > > FE_FETCH_R                                               $8, !3, ->26
    7    10    > > FE_RESET_R                                       $9      !3, ->24
         11    > > FE_FETCH_R                                               $9, !4, ->24
    8    12    >   INIT_FCALL                                               'implode'
         13        SEND_VAL                                                 '%5C%2F'
         14        INIT_FCALL                                               'explode'
         15        SEND_VAL                                                 '%2F'
         16        SEND_VAR                                                 !4
         17        DO_ICALL                                         $10     
         18        SEND_VAR                                                 $10
         19        DO_ICALL                                         $11     
         20        CONCAT                                           ~12     '%2F', $11
         21        CONCAT                                           ~13     ~12, '%2F'
         22        ASSIGN                                                   !4, ~13
    7    23      > JMP                                                      ->11
         24    >   FE_FREE                                                  $9
    6    25      > JMP                                                      ->9
         26    >   FE_FREE                                                  $8
   15    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
   16    30        ASSIGN_DIM                                               !2, 0
         31        OP_DATA                                                  'test1'
   17    32        ASSIGN_DIM                                               !2, 1
         33        OP_DATA                                                  'test2'
   18    34        INIT_FCALL                                               'preg_replace'
         35        FETCH_DIM_R                                      ~18     !1, 0
         36        SEND_VAL                                                 ~18
         37        SEND_VAR                                                 !2
         38        SEND_VAR                                                 !0
         39        DO_ICALL                                         $19     
         40        ECHO                                                     $19
   19    41    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.18 ms | 1400 KiB | 23 Q