3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertToTimestamp($str) { $str = trim($str); if (!function_exists('date_create')) { $ts = strtotime($str); // Doku: Vor PHP 5.1.0 gab die Funktion -1 im Fehlerfall zurück. #if ($ts === -1) $ts = false; return $ts; } $oDate = date_create($str); if (is_object($oDate)) { return (int)$oDate->format('U'); } return false; } var_dump( convertToTimestamp("2012-01-01") ); // 1325376000 echo "\n"; var_dump( convertToTimestamp("foo") ); // sollte false oder -1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S4itR
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'converttotimestamp'
          2        SEND_VAL                                                 '2012-01-01'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   22     6        ECHO                                                     '%0A'
   23     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'converttotimestamp'
          9        SEND_VAL                                                 'foo'
         10        DO_FCALL                                      0  $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function converttotimestamp:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S4itR
function name:  convertToTimestamp
number of ops:  28
compiled vars:  !0 = $str, !1 = $ts, !2 = $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                                         $3      
          4        ASSIGN                                                   !0, $3
    6     5        INIT_FCALL                                               'function_exists'
          6        SEND_VAL                                                 'date_create'
          7        DO_ICALL                                         $5      
          8        BOOL_NOT                                         ~6      $5
          9      > JMPZ                                                     ~6, ->15
    7    10    >   INIT_FCALL                                               'strtotime'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $7      
         13        ASSIGN                                                   !1, $7
   10    14      > RETURN                                                   !1
   13    15    >   INIT_FCALL                                               'date_create'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $9      
         18        ASSIGN                                                   !2, $9
   14    19        TYPE_CHECK                                  256          !2
         20      > JMPZ                                                     ~11, ->26
   15    21    >   INIT_METHOD_CALL                                         !2, 'format'
         22        SEND_VAL_EX                                              'U'
         23        DO_FCALL                                      0  $12     
         24        CAST                                          4  ~13     $12
         25      > RETURN                                                   ~13
   17    26    > > RETURN                                                   <false>
   18    27*     > RETURN                                                   null

End of function converttotimestamp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.18 ms | 1403 KiB | 25 Q