3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo implements \JsonSerializable { public function jsonSerialize() { return new self; } } var_dump(json_encode(new Foo));
based on PQj2L
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/tLMv6
function name:  (null)
number of ops:  12
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   DECLARE_CLASS                                    $0      'foo'
         1        ADD_INTERFACE                                            $0, 'JsonSerializable'
         2        VERIFY_ABSTRACT_CLASS                                    $0
   9     3        INIT_FCALL                                               'var_dump'
         4        INIT_FCALL                                               'json_encode'
         5        NEW                                              $1      :1
         6        DO_FCALL                                      0          
         7        SEND_VAR                                                 $1
         8        DO_ICALL                                         $3      
         9        SEND_VAR                                                 $3
        10        DO_ICALL                                                 
        11      > RETURN                                                   1

Class Foo:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
Jump found. (Code = 62) Position 1 = -2
filename:       /in/tLMv6
function name:  jsonSerialize
number of ops:  4
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   NEW                                              $0      :27
         1        DO_FCALL                                      0          
         2      > RETURN                                                   $0
   6     3*     > RETURN                                                   null

End of function jsonserialize

End of class Foo.

Generated using Vulcan Logic Dumper, using php 7.1.0