3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CDateTime extends DateTime { public function __toString() { return $this->format('Y-m-d H:i'); } public function ConvertfromString( $date , $input , $output ) { $output = ""; $dt = $this->createFromFormat($input, $date ); $output = $dt->format( $output ); return ($output); } public function diff($now = 'NOW') { if ( !($now instanceOf DateTime) ) { $now = new DateTime($now); }; return parent::diff($now); } public function getAge($now = 'NOW') { return $this->diff($now)->format('%y'); } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yk9pV
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'cdatetime', 'datetime'
   34     1      > RETURN                                                   1

Class CDateTime:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yk9pV
function name:  __toString
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_METHOD_CALL                                         'format'
          1        SEND_VAL_EX                                              'Y-m-d+H%3Ai'
          2        DO_FCALL                                      0  $0      
          3        VERIFY_RETURN_TYPE                                       $0
          4      > RETURN                                                   $0
    9     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function __tostring

Function convertfromstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yk9pV
function name:  ConvertfromString
number of ops:  15
compiled vars:  !0 = $date, !1 = $input, !2 = $output, !3 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   13     3        ASSIGN                                                   !2, ''
   14     4        INIT_METHOD_CALL                                         'createFromFormat'
          5        SEND_VAR_EX                                              !1
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $5      
          8        ASSIGN                                                   !3, $5
   15     9        INIT_METHOD_CALL                                         !3, 'format'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0  $7      
         12        ASSIGN                                                   !2, $7
   16    13      > RETURN                                                   !2
   17    14*     > RETURN                                                   null

End of function convertfromstring

Function diff:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/Yk9pV
function name:  diff
number of ops:  13
compiled vars:  !0 = $now
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV_INIT                                        !0      'NOW'
   21     1        INSTANCEOF                                       ~1      !0, 'DateTime'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->8
   23     4    >   NEW                                              $3      'DateTime'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $3
   26     8    >   INIT_STATIC_METHOD_CALL                                  'diff'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $6      
         11      > RETURN                                                   $6
   27    12*     > RETURN                                                   null

End of function diff

Function getage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Yk9pV
function name:  getAge
number of ops:  9
compiled vars:  !0 = $now
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV_INIT                                        !0      'NOW'
   31     1        INIT_METHOD_CALL                                         'diff'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        INIT_METHOD_CALL                                         $1, 'format'
          5        SEND_VAL_EX                                              '%25y'
          6        DO_FCALL                                      0  $2      
          7      > RETURN                                                   $2
   32     8*     > RETURN                                                   null

End of function getage

End of class CDateTime.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.98 ms | 1399 KiB | 13 Q