3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '/Date(1576648800000)/'; if(preg_match('/\((\d+)\)/',$str,$matches) === 1){ $date = date("Y-m-d H:i:s",intval($matches[1]) / 1000); echo $date; }else{ throw new Exception('Unexpected format received from the API'); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/cOCIq
function name:  (null)
number of ops:  23
compiled vars:  !0 = $str, !1 = $matches, !2 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2FDate%281576648800000%29%2F'
    4     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5C%28%28%5Cd%2B%29%5C%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $4      
          6        IS_IDENTICAL                                             $4, 1
          7      > JMPZ                                                     ~5, ->18
    5     8    >   INIT_FCALL                                               'date'
          9        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         10        FETCH_DIM_R                                      ~6      !1, 1
         11        CAST                                          4  ~7      ~6
         12        DIV                                              ~8      ~7, 1000
         13        SEND_VAL                                                 ~8
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !2, $9
    6    16        ECHO                                                     !2
    4    17      > JMP                                                      ->22
    8    18    >   NEW                                              $11     'Exception'
         19        SEND_VAL_EX                                              'Unexpected+format+received+from+the+API'
         20        DO_FCALL                                      0          
         21      > THROW                                         0          $11
    9    22    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.09 ms | 1011 KiB | 15 Q