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/19sPU
function name:  (null)
number of ops:  22
compiled vars:  !0 = $schema, !1 = $ref, !2 = $referencedValue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A++++%22properties%22%3A+%7B%0A++++++++%22foo%22%3A+%7B%22%24ref%22%3A+%22%23%22%7D%0A++++%7D%2C%0A++++%22additionalProperties%22%3A+false%0A%7D'
   12     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
   15     5        FETCH_OBJ_UNSET                                  $6      !0, 'properties'
          6        UNSET_OBJ                                                $6, 'foo'
   17     7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F19sPU%3A17%240'
          8        BIND_LEXICAL                                             ~9, !0
          9        FETCH_OBJ_W                                      $7      !0, 'properties'
         10        ASSIGN_OBJ                                               $7, 'foo'
         11        OP_DATA                                                  ~9
   20    12        FETCH_OBJ_R                                      ~10     !0, 'properties'
         13        FETCH_OBJ_R                                      ~11     ~10, 'foo'
         14        ASSIGN                                                   !1, ~11
   21    15        INIT_DYNAMIC_CALL                                        !1
         16        DO_FCALL                                      0  $13     
         17        ASSIGN                                                   !2, $13
   23    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F19sPU%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/19sPU
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%2F19sPU%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.05 ms | 1396 KiB | 17 Q