3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = array( false, 'sdfasas', '0000-00-00', '0000-00-00 00:00:00', '1231231', '2013-03-02 02:03:03', '2014-04-21', ); function getJsonDate($unixTimestamp = null) { if (is_null($unixTimestamp)) { $unixTimestamp = time(); } return '/Date(' . ($unixTimestamp * 1000) . date('O') . ')/'; } foreach($time as $s) { $iStartTime = ((strtotime($s) >= 0) ? strtotime($s) : 0); var_dump(getJsonDate($iStartTime)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 22
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/9rT27
function name:  (null)
number of ops:  24
compiled vars:  !0 = $time, !1 = $s, !2 = $iStartTime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   21     1      > FE_RESET_R                                       $4      !0, ->22
          2    > > FE_FETCH_R                                               $4, !1, ->22
   22     3    >   INIT_FCALL                                               'strtotime'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $5      
          6        IS_SMALLER_OR_EQUAL                                      0, $5
          7      > JMPZ                                                     ~6, ->13
          8    >   INIT_FCALL                                               'strtotime'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $7      
         11        QM_ASSIGN                                        ~8      $7
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~8      0
         14    >   ASSIGN                                                   !2, ~8
   23    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'getjsondate'
         17        SEND_VAR                                                 !2
         18        DO_FCALL                                      0  $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                                 
   21    21      > JMP                                                      ->2
         22    >   FE_FREE                                                  $4
   24    23      > RETURN                                                   1

Function getjsondate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/9rT27
function name:  getJsonDate
number of ops:  15
compiled vars:  !0 = $unixTimestamp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV_INIT                                        !0      null
   14     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->6
   15     3    >   INIT_FCALL                                               'time'
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !0, $2
   18     6    >   MUL                                              ~4      !0, 1000
          7        CONCAT                                           ~5      '%2FDate%28', ~4
          8        INIT_FCALL                                               'date'
          9        SEND_VAL                                                 'O'
         10        DO_ICALL                                         $6      
         11        CONCAT                                           ~7      ~5, $6
         12        CONCAT                                           ~8      ~7, '%29%2F'
         13      > RETURN                                                   ~8
   19    14*     > RETURN                                                   null

End of function getjsondate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.1 ms | 1403 KiB | 22 Q