3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = '28/5/1972'; $formats = [ 'dd/MM/yyyy', 'd/m/Y', ]; foreach ($formats as $format) { var_dump($format); $intlDateFormatter = new IntlDateFormatter( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles', IntlDateFormatter::GREGORIAN, $format ); $intlDateFormatter->setLenient(false); var_dump($intlDateFormatter->parse($date)); var_dump($intlDateFormatter->getErrorMessage()); $intlDateFormatter->setLenient(true); var_dump($intlDateFormatter->parse($date)); var_dump($intlDateFormatter->getErrorMessage()); } $fmt = new IntlDateFormatter( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles', IntlDateFormatter::GREGORIAN, 'dd/MM/yyyy' ); echo 'lenient of the formatter is : '; if ($fmt->isLenient()) { echo 'TRUE'; } else { echo 'FALSE'; } $fmt->parse('35/13/1971'); echo "\n Trying to do parse('35/13/1971').\nResult is : " . $fmt->parse('35/13/1971');
based on emYiX
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 3, Position 2 = 48
Branch analysis from position: 3
Jump found. Position 1 = 4, Position 2 = 48
Branch analysis from position: 4
Jump found. Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 48
Jump found. Position 1 = 65, Position 2 = 67
Branch analysis from position: 65
Jump found. Position 1 = 68
Branch analysis from position: 68
Jump found. Position 1 = -2
Branch analysis from position: 67
Jump found. Position 1 = -2
Branch analysis from position: 48
filename:       /in/KZOVa
function name:  (null)
number of ops:  77
compiled vars:  !0 = $date, !1 = $formats, !2 = $format, !3 = $intlDateFormatter, !4 = $fmt
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, '28%2F5%2F1972'
   5     1        ASSIGN                                                   !1, <array>
   9     2      > FE_RESET_R                                       $7      !1, ->48
         3    > > FE_FETCH_R                                               $7, !2, ->48
  10     4    >   INIT_FCALL                                               'var_dump'
         5        SEND_VAR                                                 !2
         6        DO_ICALL                                                 
  11     7        NEW                                              $9      :-3
  12     8        SEND_VAL_EX                                              'en_US'
  13     9        FETCH_CONSTANT                                   ~10     'IntlDateFormatter', 'FULL'
        10        SEND_VAL_EX                                              ~10
  14    11        FETCH_CONSTANT                                   ~11     'IntlDateFormatter', 'FULL'
        12        SEND_VAL_EX                                              ~11
  15    13        SEND_VAL_EX                                              'America%2FLos_Angeles'
  16    14        FETCH_CONSTANT                                   ~12     'IntlDateFormatter', 'GREGORIAN'
        15        SEND_VAL_EX                                              ~12
        16        SEND_VAR_EX                                              !2
        17        DO_FCALL                                      0          
        18        ASSIGN                                                   !3, $9
  21    19        INIT_METHOD_CALL                                         !3, 'setLenient'
        20        SEND_VAL_EX                                              <false>
        21        DO_FCALL                                      0          
  22    22        INIT_FCALL                                               'var_dump'
        23        INIT_METHOD_CALL                                         !3, 'parse'
        24        SEND_VAR_EX                                              !0
        25        DO_FCALL                                      0  $16     
        26        SEND_VAR                                                 $16
        27        DO_ICALL                                                 
  23    28        INIT_FCALL                                               'var_dump'
        29        INIT_METHOD_CALL                                         !3, 'getErrorMessage'
        30        DO_FCALL                                      0  $18     
        31        SEND_VAR                                                 $18
        32        DO_ICALL                                                 
  25    33        INIT_METHOD_CALL                                         !3, 'setLenient'
        34        SEND_VAL_EX                                              <true>
        35        DO_FCALL                                      0          
  26    36        INIT_FCALL                                               'var_dump'
        37        INIT_METHOD_CALL                                         !3, 'parse'
        38        SEND_VAR_EX                                              !0
        39        DO_FCALL                                      0  $21     
        40        SEND_VAR                                                 $21
        41        DO_ICALL                                                 
  27    42        INIT_FCALL                                               'var_dump'
        43        INIT_METHOD_CALL                                         !3, 'getErrorMessage'
        44        DO_FCALL                                      0  $23     
        45        SEND_VAR                                                 $23
        46        DO_ICALL                                                 
        47      > JMP                                                      ->3
        48    >   FE_FREE                                                  $7
  30    49        NEW                                              $25     :28
  31    50        SEND_VAL_EX                                              'en_US'
  32    51        FETCH_CONSTANT                                   ~26     'IntlDateFormatter', 'FULL'
        52        SEND_VAL_EX                                              ~26
  33    53        FETCH_CONSTANT                                   ~27     'IntlDateFormatter', 'FULL'
        54        SEND_VAL_EX                                              ~27
  34    55        SEND_VAL_EX                                              'America%2FLos_Angeles'
  35    56        FETCH_CONSTANT                                   ~28     'IntlDateFormatter', 'GREGORIAN'
        57        SEND_VAL_EX                                              ~28
  36    58        SEND_VAL_EX                                              'dd%2FMM%2Fyyyy'
        59        DO_FCALL                                      0          
        60        ASSIGN                                                   !4, $25
  38    61        ECHO                                                     'lenient+of+the+formatter+is+%3A+'
  39    62        INIT_METHOD_CALL                                         !4, 'isLenient'
        63        DO_FCALL                                      0  $31     
        64      > JMPZ                                                     $31, ->67
  40    65    >   ECHO                                                     'TRUE'
        66      > JMP                                                      ->68
  42    67    >   ECHO                                                     'FALSE'
  44    68    >   INIT_METHOD_CALL                                         !4, 'parse'
        69        SEND_VAL_EX                                              '35%2F13%2F1971'
        70        DO_FCALL                                      0          
  45    71        INIT_METHOD_CALL                                         !4, 'parse'
        72        SEND_VAL_EX                                              '35%2F13%2F1971'
        73        DO_FCALL                                      0  $33     
        74        CONCAT                                           ~34     '%0A+Trying+to+do+parse%28%2735%2F13%2F1971%27%29.%0AResult+is+%3A+', $33
        75        ECHO                                                     ~34
        76      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0