3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(new DateTimeImmutable() instanceof Jsonserializeable); var_dump(new DateTime() instanceof JsonSerializeable); // And this works even without it... // ----------- class Test extends DateTime implements JsonSerializeable { public function jsonSerialize() { return "called"; } } var_dump(json_encode(new DateTime('2015-05-03')));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r3SoZ
function name:  (null)
number of ops:  23
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'DateTimeImmutable'
          2        DO_FCALL                                      0          
          3        INSTANCEOF                                       ~2      $0, 'Jsonserializeable'
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
    4     6        INIT_FCALL                                               'var_dump'
          7        NEW                                              $4      'DateTime'
          8        DO_FCALL                                      0          
          9        INSTANCEOF                                       ~6      $4, 'JsonSerializeable'
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                                 
    9    12        DECLARE_CLASS                                            'test', 'datetime'
   15    13        INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'json_encode'
         15        NEW                                              $8      'DateTime'
         16        SEND_VAL_EX                                              '2015-05-03'
         17        DO_FCALL                                      0          
         18        SEND_VAR                                                 $8
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Class Test:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r3SoZ
function name:  jsonSerialize
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   'called'
   12     1*     > RETURN                                                   null

End of function jsonserialize

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.96 ms | 1395 KiB | 17 Q