3v4l.org

run code in 300+ PHP versions simultaneously
<?php class SerialDateTime extends DateTime implements JsonSerializable{ public function jsonSerialize(){ return ['timestamp' => $this->getTimestamp()]; } public function __toString(){ return $this->getTimestamp(); } // TODO: Is this the best way, or is there a better way? public static function createFromFormat($f, $t, $tz=NULL){ $dateTime = call_user_func( array('SerialDateTime', 'parent::createFromFormat'), $f, $t, $tz ); $ret = new self(); return $ret->setTimestamp($dateTime->getTimestamp()); } } echo strnatcasecmp(new SerialDateTime, new SerialDateTime('January 1, 2013'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rIL9e
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'serialdatetime', 'datetime'
   24     1        INIT_FCALL                                               'strnatcasecmp'
          2        NEW                                              $0      'SerialDateTime'
          3        DO_FCALL                                      0          
          4        SEND_VAR                                                 $0
          5        NEW                                              $2      'SerialDateTime'
          6        SEND_VAL_EX                                              'January+1%2C+2013'
          7        DO_FCALL                                      0          
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $4      
         10        ECHO                                                     $4
         11      > RETURN                                                   1

Class SerialDateTime:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rIL9e
function name:  jsonSerialize
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_METHOD_CALL                                         'getTimestamp'
          1        DO_FCALL                                      0  $0      
          2        INIT_ARRAY                                       ~1      $0, 'timestamp'
          3      > RETURN                                                   ~1
    7     4*     > RETURN                                                   null

End of function jsonserialize

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rIL9e
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_METHOD_CALL                                         'getTimestamp'
          1        DO_FCALL                                      0  $0      
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   11     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __tostring

Function createfromformat:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rIL9e
function name:  createFromFormat
number of ops:  19
compiled vars:  !0 = $f, !1 = $t, !2 = $tz, !3 = $dateTime, !4 = $ret
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
   16     3        INIT_USER_CALL                                3          'call_user_func', <array>
   17     4        SEND_USER                                                !0
          5        SEND_USER                                                !1
          6        SEND_USER                                                !2
          7        DO_FCALL                                      0  $5      
   15     8        ASSIGN                                                   !3, $5
   19     9        NEW                          self                $7      
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !4, $7
   20    12        INIT_METHOD_CALL                                         !4, 'setTimestamp'
         13        INIT_METHOD_CALL                                         !3, 'getTimestamp'
         14        DO_FCALL                                      0  $10     
         15        SEND_VAR_NO_REF_EX                                       $10
         16        DO_FCALL                                      0  $11     
         17      > RETURN                                                   $11
   21    18*     > RETURN                                                   null

End of function createfromformat

End of class SerialDateTime.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.75 ms | 1400 KiB | 15 Q