3v4l.org

run code in 300+ PHP versions simultaneously
<?php function createDateFromFormat($format, $time) { $result = \DateTimeImmutable::createFromFormat($format, $time); var_dump(\DateTimeImmutable::getLastErrors()); return $result; } var_dump(\DateTimeImmutable::createFromFormat('Y-m-d', '2005-12-1')); var_dump(\DateTimeImmutable::createFromFormat('Y-m-d', '2005')); // should be false var_dump(\DateTimeImmutable::createFromFormat('Y-m-d', '0-0-0')); // should be false var_dump(createDateFromFormat('Y-m-d', '2005-12-1')); var_dump(createDateFromFormat('Y-m-d', '2005')); // should be false var_dump(createDateFromFormat('Y-m-d', '0-0-0')); // should be false
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sDspj
function name:  (null)
number of ops:  43
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromFormat'
          2        SEND_VAL                                                 'Y-m-d'
          3        SEND_VAL                                                 '2005-12-1'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   13     7        INIT_FCALL                                               'var_dump'
          8        INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromFormat'
          9        SEND_VAL                                                 'Y-m-d'
         10        SEND_VAL                                                 '2005'
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                                 
   14    14        INIT_FCALL                                               'var_dump'
         15        INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromFormat'
         16        SEND_VAL                                                 'Y-m-d'
         17        SEND_VAL                                                 '0-0-0'
         18        DO_FCALL                                      0  $4      
         19        SEND_VAR                                                 $4
         20        DO_ICALL                                                 
   17    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'createdatefromformat'
         23        SEND_VAL                                                 'Y-m-d'
         24        SEND_VAL                                                 '2005-12-1'
         25        DO_FCALL                                      0  $6      
         26        SEND_VAR                                                 $6
         27        DO_ICALL                                                 
   18    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL                                               'createdatefromformat'
         30        SEND_VAL                                                 'Y-m-d'
         31        SEND_VAL                                                 '2005'
         32        DO_FCALL                                      0  $8      
         33        SEND_VAR                                                 $8
         34        DO_ICALL                                                 
   19    35        INIT_FCALL                                               'var_dump'
         36        INIT_FCALL                                               'createdatefromformat'
         37        SEND_VAL                                                 'Y-m-d'
         38        SEND_VAL                                                 '0-0-0'
         39        DO_FCALL                                      0  $10     
         40        SEND_VAR                                                 $10
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Function createdatefromformat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sDspj
function name:  createDateFromFormat
number of ops:  14
compiled vars:  !0 = $format, !1 = $time, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'createFromFormat'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !2, $3
    6     7        INIT_FCALL                                               'var_dump'
          8        INIT_STATIC_METHOD_CALL                                  'DateTimeImmutable', 'getLastErrors'
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
    8    12      > RETURN                                                   !2
    9    13*     > RETURN                                                   null

End of function createdatefromformat

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.56 ms | 1403 KiB | 18 Q