3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'blah' => 'reference', ], [ 'A' => 'SMI13', 'B' => '03/12/1940', 'C' => '', ] ]; foreach($data as &$record){ foreach($record as $key => $val){ //you might want to consider using preg_replace_callback instead: if(preg_match("/^(((0[13578]|1[02])\/(0[1-9]|[12]\d|3[01])\/((19|[2-9]\d)\d{2}))|((0[13456789]|1[012])\/(0[1-9]|[12]\d|30)\/((19|[2-9]\d)\d{2}))|(02\/(0[1-9]|1\d|2[0-8])\/((19|[2-9]\d)\d{2}))|(02\/29\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/",$val)) { echo "match! $val \n"; $record [$key] = date("Y-m-d", strtotime($val)); } } } unset($record); var_dump($data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 27
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 27
Branch analysis from position: 3
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 25
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 25
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 24
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 24
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 25
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/oHsOk
function name:  (null)
number of ops:  33
compiled vars:  !0 = $data, !1 = $record, !2 = $val, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   14     1      > FE_RESET_RW                                      $5      !0, ->27
          2    > > FE_FETCH_RW                                              $5, !1, ->27
   16     3    > > FE_RESET_R                                       $6      !1, ->25
          4    > > FE_FETCH_R                                       ~7      $6, !2, ->25
          5    >   ASSIGN                                                   !3, ~7
   18     6        INIT_FCALL                                               'preg_match'
          7        SEND_VAL                                                 '%2F%5E%28%28%280%5B13578%5D%7C1%5B02%5D%29%5C%2F%280%5B1-9%5D%7C%5B12%5D%5Cd%7C3%5B01%5D%29%5C%2F%28%2819%7C%5B2-9%5D%5Cd%29%5Cd%7B2%7D%29%29%7C%28%280%5B13456789%5D%7C1%5B012%5D%29%5C%2F%280%5B1-9%5D%7C%5B12%5D%5Cd%7C30%29%5C%2F%28%2819%7C%5B2-9%5D%5Cd%29%5Cd%7B2%7D%29%29%7C%2802%5C%2F%280%5B1-9%5D%7C1%5Cd%7C2%5B0-8%5D%29%5C%2F%28%2819%7C%5B2-9%5D%5Cd%29%5Cd%7B2%7D%29%29%7C%2802%5C%2F29%5C%2F%28%281%5B6-9%5D%7C%5B2-9%5D%5Cd%29%280%5B48%5D%7C%5B2468%5D%5B048%5D%7C%5B13579%5D%5B26%5D%29%7C%28%2816%7C%5B2468%5D%5B048%5D%7C%5B3579%5D%5B26%5D%2900%29%29%29%29%24%2F'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $9      
         10      > JMPZ                                                     $9, ->24
   19    11    >   ROPE_INIT                                     3  ~11     'match%21+'
         12        ROPE_ADD                                      1  ~11     ~11, !2
         13        ROPE_END                                      2  ~10     ~11, '+%0A'
         14        ECHO                                                     ~10
   20    15        INIT_FCALL                                               'date'
         16        SEND_VAL                                                 'Y-m-d'
         17        INIT_FCALL                                               'strtotime'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                         $14     
         20        SEND_VAR                                                 $14
         21        DO_ICALL                                         $15     
         22        ASSIGN_DIM                                               !1, !3
         23        OP_DATA                                                  $15
   16    24    > > JMP                                                      ->4
         25    >   FE_FREE                                                  $6
   14    26      > JMP                                                      ->2
         27    >   FE_FREE                                                  $5
   25    28        UNSET_CV                                                 !1
   26    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.17 ms | 1400 KiB | 21 Q