3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum Toto: string implements JsonSerializable { case Foo = 'Yo'; case Yo = 'Foo'; public function jsonSerialize(): string { return "gotcha"; } } enum Tata: string { case Foo = 'Yo'; case Yo = 'Foo'; public function jsonSerialize(): string { return "gotcha"; } } $params = ['a' => Toto::Foo, 'aa' => Tata::Foo]; echo json_encode($params), PHP_EOL; echo http_build_query($params), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hXsGV
function name:  (null)
number of ops:  18
compiled vars:  !0 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'toto'
   14     1        DECLARE_CLASS                                            'tata'
   25     2        FETCH_CLASS_CONSTANT                             ~1      'Toto', 'Foo'
          3        INIT_ARRAY                                       ~2      ~1, 'a'
          4        FETCH_CLASS_CONSTANT                             ~3      'Tata', 'Foo'
          5        ADD_ARRAY_ELEMENT                                ~2      ~3, 'aa'
          6        ASSIGN                                                   !0, ~2
   27     7        INIT_FCALL                                               'json_encode'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        ECHO                                                     $5
         11        ECHO                                                     '%0A'
   28    12        INIT_FCALL                                               'http_build_query'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $6      
         15        ECHO                                                     $6
         16        ECHO                                                     '%0A'
   29    17      > RETURN                                                   1

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

End of function jsonserialize

End of class Toto.

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

End of function jsonserialize

End of class Tata.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.29 ms | 1015 KiB | 15 Q