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); foreach ($matches[1] as $day) { $days [] = $day; } foreach ($matches[2] as $month) { $months [] = $month; } foreach ($matches[3] as $year) { $years [] = $year; } $all_months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); for ($i = sizeof($days) - 1; $i >= 0; $i --) { $month = array_search($months[$i], $all_months) + 1; $month = strlen($month) < 2 ? '0'.$month : $month; $results [] = $years[$i] . '-' . $month . '-' . $days[$i]; } return $results; } $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/HCBiG
function name:  (null)
number of ops:  15
compiled vars:  !0 = $str1, !1 = $str2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, 'Company+registered+on+16+March+2003'
   20     1        ASSIGN                                                   !1, 'Activity+between+10+May+2006+an+10+July+2008+-+no+changes.'
   22     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                                                 
   23     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
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 26
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 26
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 32
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 45
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 32
Branch analysis from position: 58
Branch analysis from position: 32
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 58, Position 2 = 32
Branch analysis from position: 58
Branch analysis from position: 32
Branch analysis from position: 26
Branch analysis from position: 19
Branch analysis from position: 12
filename:       /in/HCBiG
function name:  standard_date_format
number of ops:  60
compiled vars:  !0 = $str, !1 = $matches, !2 = $day, !3 = $days, !4 = $month, !5 = $months, !6 = $year, !7 = $years, !8 = $all_months, !9 = $i, !10 = $results
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        FETCH_DIM_R                                      ~12     !1, 1
          7      > FE_RESET_R                                       $13     ~12, ->12
          8    > > FE_FETCH_R                                               $13, !2, ->12
          9    >   ASSIGN_DIM                                               !3
         10        OP_DATA                                                  !2
         11      > JMP                                                      ->8
         12    >   FE_FREE                                                  $13
    6    13        FETCH_DIM_R                                      ~15     !1, 2
         14      > FE_RESET_R                                       $16     ~15, ->19
         15    > > FE_FETCH_R                                               $16, !4, ->19
         16    >   ASSIGN_DIM                                               !5
         17        OP_DATA                                                  !4
         18      > JMP                                                      ->15
         19    >   FE_FREE                                                  $16
    7    20        FETCH_DIM_R                                      ~18     !1, 3
         21      > FE_RESET_R                                       $19     ~18, ->26
         22    > > FE_FETCH_R                                               $19, !6, ->26
         23    >   ASSIGN_DIM                                               !7
         24        OP_DATA                                                  !6
         25      > JMP                                                      ->22
         26    >   FE_FREE                                                  $19
    9    27        ASSIGN                                                   !8, <array>
   11    28        COUNT                                            ~22     !3
         29        SUB                                              ~23     ~22, 1
         30        ASSIGN                                                   !9, ~23
         31      > JMP                                                      ->56
   12    32    >   INIT_FCALL                                               'array_search'
         33        FETCH_DIM_R                                      ~25     !5, !9
         34        SEND_VAL                                                 ~25
         35        SEND_VAR                                                 !8
         36        DO_ICALL                                         $26     
         37        ADD                                              ~27     $26, 1
         38        ASSIGN                                                   !4, ~27
   13    39        STRLEN                                           ~29     !4
         40        IS_SMALLER                                               ~29, 2
         41      > JMPZ                                                     ~30, ->45
         42    >   CONCAT                                           ~31     '0', !4
         43        QM_ASSIGN                                        ~32     ~31
         44      > JMP                                                      ->46
         45    >   QM_ASSIGN                                        ~32     !4
         46    >   ASSIGN                                                   !4, ~32
   14    47        FETCH_DIM_R                                      ~35     !7, !9
         48        CONCAT                                           ~36     ~35, '-'
         49        CONCAT                                           ~37     ~36, !4
         50        CONCAT                                           ~38     ~37, '-'
         51        FETCH_DIM_R                                      ~39     !3, !9
         52        CONCAT                                           ~40     ~38, ~39
         53        ASSIGN_DIM                                               !10
         54        OP_DATA                                                  ~40
   11    55        PRE_DEC                                                  !9
         56    >   IS_SMALLER_OR_EQUAL                                      0, !9
         57      > JMPNZ                                                    ~42, ->32
   16    58    > > RETURN                                                   !10
   17    59*     > RETURN                                                   null

End of function standard_date_format

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.87 ms | 1473 KiB | 18 Q