3v4l.org

run code in 300+ PHP versions simultaneously
<?php $family_ids = array(1,2,3,4,5,6); $data = []; foreach ($family_ids as $fam_member){ $data[]= ["type"=>"Person","id"=> $fam_member]; } $household = '{ "data": { "attributes": { "name":"xxxxxx" }, "relationships": { "people":{ "data":'. json_encode($data) . ' }, "primary_contact":{ "data":{"type":"Person","id":"1"} } } } }'; echo($household);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/enrGP
function name:  (null)
number of ops:  18
compiled vars:  !0 = $family_ids, !1 = $data, !2 = $fam_member, !3 = $household
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
    7     2      > FE_RESET_R                                       $6      !0, ->9
          3    > > FE_FETCH_R                                               $6, !2, ->9
    8     4    >   INIT_ARRAY                                       ~8      'Person', 'type'
          5        ADD_ARRAY_ELEMENT                                ~8      !2, 'id'
          6        ASSIGN_DIM                                               !1
          7        OP_DATA                                                  ~8
    7     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $6
   19    10        INIT_FCALL                                               'json_encode'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $9      
         13        CONCAT                                           ~10     '%7B%0A++++++++++++++++%22data%22%3A+%7B%0A++++++++++++++++++++%22attributes%22%3A+%7B%0A++++++++++++++++++++++++%22name%22%3A%22xxxxxx%22%0A++++++++++++++++++++%7D%2C%0A++++++++++++++++++++%22relationships%22%3A+%7B%0A++++++++++++++++++++++++%22people%22%3A%7B%0A++++++++++++++++++++++++++++%22data%22%3A', $9
         14        CONCAT                                           ~11     ~10, '%0A++++++++++++++++++++++++%7D%2C%0A++++++++++++++++++++++++%22primary_contact%22%3A%7B%0A++++++++++++++++++++++++++++%22data%22%3A%7B%22type%22%3A%22Person%22%2C%22id%22%3A%221%22%7D%0A++++++++++++++++++++++++%7D%0A++++++++++++++++++++%7D%0A++++++++++++++++%7D%0A++++++++++++%7D'
   12    15        ASSIGN                                                   !3, ~11
   28    16        ECHO                                                     !3
         17      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
273.97 ms | 1000 KiB | 14 Q