3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CustomDateTime extends DateTime{ public function __toString(){ return $this->format('Y-m-d H:i:s'); } } $datetime = new CustomDateTime(); $sql = "... when_inserted = '$datetime'"; echo $sql;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JGaN5
function name:  (null)
number of ops:  10
compiled vars:  !0 = $datetime, !1 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'customdatetime', 'datetime'
    9     1        NEW                                              $2      'CustomDateTime'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   10     4        ROPE_INIT                                     3  ~6      '...+when_inserted+%3D+%27'
          5        ROPE_ADD                                      1  ~6      ~6, !0
          6        ROPE_END                                      2  ~5      ~6, '%27'
          7        ASSIGN                                                   !1, ~5
   12     8        ECHO                                                     !1
   13     9      > RETURN                                                   1

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

End of function __tostring

End of class CustomDateTime.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.07 ms | 994 KiB | 13 Q