3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertToTimestamp($dateStr) { $dateStr = trim($dateStr); #var_dump( function_exists("date_create") ); if (!function_exists('date_create')) { return strtotime($dateStr); } $oDate = date_create($dateStr); if (is_object($oDate)) { return (int)$oDate->format('U'); } return false; } echo convertToTimestamp("2012-01-01"); // 1325376000 echo "<br>"; var_dump( convertToTimestamp("foo") ); // sollte false
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rkg1X
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'converttotimestamp'
          1        SEND_VAL                                                 '2012-01-01'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   21     4        ECHO                                                     '%3Cbr%3E'
   22     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'converttotimestamp'
          7        SEND_VAL                                                 'foo'
          8        DO_FCALL                                      0  $1      
          9        SEND_VAR                                                 $1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function converttotimestamp:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rkg1X
function name:  convertToTimestamp
number of ops:  27
compiled vars:  !0 = $dateStr, !1 = $oDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'trim'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !0, $2
    8     5        INIT_FCALL                                               'function_exists'
          6        SEND_VAL                                                 'date_create'
          7        DO_ICALL                                         $4      
          8        BOOL_NOT                                         ~5      $4
          9      > JMPZ                                                     ~5, ->14
    9    10    >   INIT_FCALL                                               'strtotime'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $6      
         13      > RETURN                                                   $6
   12    14    >   INIT_FCALL                                               'date_create'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $7      
         17        ASSIGN                                                   !1, $7
   13    18        TYPE_CHECK                                  256          !1
         19      > JMPZ                                                     ~9, ->25
   14    20    >   INIT_METHOD_CALL                                         !1, 'format'
         21        SEND_VAL_EX                                              'U'
         22        DO_FCALL                                      0  $10     
         23        CAST                                          4  ~11     $10
         24      > RETURN                                                   ~11
   16    25    > > RETURN                                                   <false>
   17    26*     > RETURN                                                   null

End of function converttotimestamp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.63 ms | 1403 KiB | 25 Q