3v4l.org

run code in 300+ PHP versions simultaneously
<?php $schema = <<<HERE { "properties": { "foo": {"$ref": "#"} }, "additionalProperties": false } HERE; $schema = json_decode($schema); // unset the ref unset($schema->properties->foo); // replace it with a closure that returns the schema when accessed. $schema->properties->foo = function () use ($schema) { return $schema; }; // If you find a closure, it's a lazy proxy. Execute it to get the value. $ref = $schema->properties->foo; $referencedValue = $ref(); // You would stop recursing if 1.) you run out of nested data or 2.) you reach the max depth. var_dump($referencedValue);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMBsC
function name:  (null)
number of ops:  25
compiled vars:  !0 = $schema, !1 = $ref, !2 = $referencedValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ROPE_INIT                                     3  ~4      '%7B%0A++++%22properties%22%3A+%7B%0A++++++++%22foo%22%3A+%7B%22'
    6     1        ROPE_ADD                                      1  ~4      ~4, !1
          2        ROPE_END                                      2  ~3      ~4, '%22%3A+%22%23%22%7D%0A++++%7D%2C%0A++++%22additionalProperties%22%3A+false%0A%7D'
    3     3        ASSIGN                                                   !0, ~3
   12     4        INIT_FCALL                                               'json_decode'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !0, $7
   15     8        FETCH_OBJ_UNSET                                  $9      !0, 'properties'
          9        UNSET_OBJ                                                $9, 'foo'
   17    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FIMBsC%3A17%240'
         11        BIND_LEXICAL                                             ~12, !0
         12        FETCH_OBJ_W                                      $10     !0, 'properties'
         13        ASSIGN_OBJ                                               $10, 'foo'
         14        OP_DATA                                                  ~12
   20    15        FETCH_OBJ_R                                      ~13     !0, 'properties'
         16        FETCH_OBJ_R                                      ~14     ~13, 'foo'
         17        ASSIGN                                                   !1, ~14
   21    18        INIT_DYNAMIC_CALL                                        !1
         19        DO_FCALL                                      0  $16     
         20        ASSIGN                                                   !2, $16
   23    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FIMBsC%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IMBsC
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $schema
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   BIND_STATIC                                              !0
          1      > RETURN                                                   !0
          2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FIMBsC%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.73 ms | 1396 KiB | 17 Q