3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "2019-08-10D00:00:03.712125000"; $parts = explode(".", $string); $microseconds = $parts[1]; $date = DateTime::createFromFormat("Y-m-d\DH:i:s", $parts[0]); $timestamp = $date->getTimestamp(); // If you want to round it to 4 decimal places // $microseconds = ltrim(round("0.".$microseconds, 4), "0."); // If you want to append the microseconds back for whichever reason // $timestamp .= ".".$microseconds; echo $timestamp;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8hqmr
function name:  (null)
number of ops:  19
compiled vars:  !0 = $string, !1 = $parts, !2 = $microseconds, !3 = $date, !4 = $timestamp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2019-08-10D00%3A00%3A03.712125000'
    4     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    5     6        FETCH_DIM_R                                      ~8      !1, 1
          7        ASSIGN                                                   !2, ~8
    7     8        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          9        SEND_VAL                                                 'Y-m-d%5CDH%3Ai%3As'
         10        FETCH_DIM_R                                      ~10     !1, 0
         11        SEND_VAL                                                 ~10
         12        DO_FCALL                                      0  $11     
         13        ASSIGN                                                   !3, $11
    8    14        INIT_METHOD_CALL                                         !3, 'getTimestamp'
         15        DO_FCALL                                      0  $13     
         16        ASSIGN                                                   !4, $13
   16    17        ECHO                                                     !4
   17    18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.51 ms | 1444 KiB | 14 Q