3v4l.org

run code in 300+ PHP versions simultaneously
<?php function standard_date_format($str) { preg_match_all('/(\d{1,2}) (\w+) (\d{4})/', $str, $matches); $dates = array_map("strtotime", $matches[0]); $result = array_map(function($v) {return date("Y-m-d", $v); }, $dates); return $result; } $str1 = "Company registered on 16 March 2003"; $str2 = "Activity between 10 May 2006 an 10 July 2008 - no changes."; print_r(standard_date_format($str1)); print_r(standard_date_format($str2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8El4I
function name:  (null)
number of ops:  15
compiled vars:  !0 = $str1, !1 = $str2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 'Company+registered+on+16+March+2003'
   11     1        ASSIGN                                                   !1, 'Activity+between+10+May+2006+an+10+July+2008+-+no+changes.'
   12     2        INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'standard_date_format'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   13     8        INIT_FCALL                                               'print_r'
          9        INIT_FCALL                                               'standard_date_format'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function standard_date_format:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8El4I
function name:  standard_date_format
number of ops:  20
compiled vars:  !0 = $str, !1 = $matches, !2 = $dates, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28%5Cd%7B1%2C2%7D%29+%28%5Cw%2B%29+%28%5Cd%7B4%7D%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    5     6        INIT_FCALL                                               'array_map'
          7        SEND_VAL                                                 'strtotime'
          8        FETCH_DIM_R                                      ~5      !1, 0
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !2, $6
    6    12        INIT_FCALL                                               'array_map'
         13        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
         14        SEND_VAL                                                 ~8
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $9      
         17        ASSIGN                                                   !3, $9
    7    18      > RETURN                                                   !3
    8    19*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8El4I
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'Y-m-d'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

End of Dynamic Function 0

End of function standard_date_format

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.52 ms | 1470 KiB | 19 Q