3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dates = array( '23.5.14', '23.05.14', '23.05.2014', '30.6.14', '30.06.14', '30.06.2014', '5/23/14', '05/23/14', '05/23/2014',);foreach ($dates as $date_in) { try { $temp_date = new DateTime($date_in); $date_out = $temp_date->format('Y-m-d'); } catch (Exception $e) { $date_out = 'error'; } printf('%1$ 12s => %2$s', $date_in, $date_out); echo "\n";}
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 21
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Found catch point at position: 12
Branch analysis from position: 12
2 jumps found. (Code = 107) Position 1 = 13, Position 2 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
filename:       /in/BXC7d
function name:  (null)
number of ops:  23
compiled vars:  !0 = $dates, !1 = $date_in, !2 = $temp_date, !3 = $date_out, !4 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
          1      > FE_RESET_R                                       $6      !0, ->21
          2    > > FE_FETCH_R                                               $6, !1, ->21
          3    >   NEW                                              $7      'DateTime'
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $7
          7        INIT_METHOD_CALL                                         !2, 'format'
          8        SEND_VAL_EX                                              'Y-m-d'
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !3, $10
         11      > JMP                                                      ->14
         12  E > > CATCH                                       last         'Exception'
         13    >   ASSIGN                                                   !3, 'error'
         14    >   INIT_FCALL                                               'printf'
         15        SEND_VAL                                                 '%251%24+12s+%3D%3E+%252%24s'
         16        SEND_VAR                                                 !1
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                                 
         19        ECHO                                                     '%0A'
         20      > JMP                                                      ->2
         21    >   FE_FREE                                                  $6
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.02 ms | 1395 KiB | 15 Q