3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements JsonSerializable{ private $foo = 'bar'; private $baz = 'quux'; public function jsonSerialize(){ return ['foo'=>$this->foo, 'baz'=>$this->baz]; } } $arr = [new Foo(), new Foo(), new Foo()]; echo json_encode($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rTpXi
function name:  (null)
number of ops:  16
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'foo'
   12     1        NEW                                              $1      'Foo'
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~3      $1
          4        NEW                                              $4      'Foo'
          5        DO_FCALL                                      0          
          6        ADD_ARRAY_ELEMENT                                ~3      $4
          7        NEW                                              $6      'Foo'
          8        DO_FCALL                                      0          
          9        ADD_ARRAY_ELEMENT                                ~3      $6
         10        ASSIGN                                                   !0, ~3
   14    11        INIT_FCALL                                               'json_encode'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $9      
         14        ECHO                                                     $9
         15      > RETURN                                                   1

Class Foo:
Function jsonserialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rTpXi
function name:  jsonSerialize
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'foo'
          1        INIT_ARRAY                                       ~1      ~0, 'foo'
          2        FETCH_OBJ_R                                      ~2      'baz'
          3        ADD_ARRAY_ELEMENT                                ~1      ~2, 'baz'
          4      > RETURN                                                   ~1
    9     5*     > RETURN                                                   null

End of function jsonserialize

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.5 ms | 1395 KiB | 15 Q