I have the following array. I am just showing number 0 to reduce the post lenght.
Array ( [0] => stdClass Object ( [type] => vector [id] => somecoolid [name] => aa_filename [center] => Array ( [0] => 139.34831290409 [1] => 38.282884929937 [2] => 2 ) [created] => 2022-12-04T01:42:56.051Z [modified] => 2022-12-04T01:44:47.634Z [visibility] => private [description] => some description [filesize] => 260139 [status] => available [tileset_precisions] => stdClass Object ( [10m] => 1608318 ) [created_by_client] => CI ) [1] => stdClass Object ...snip... The entire array is assigned to $getBodyTilesets. To access most of the data, I use the following loop;
<?php foreach ($getBodyTilesets as $getBodyTileset) : ?> <?= $getBodyTileset->id ?> <?= $getBodyTileset->type ?></td> <?= $getBodyTileset->name ?></td> <?= $getBodyTileset->center[0] ?> <?= $getBodyTileset->center[1] ?> <?= $getBodyTileset->center[2] ?></td> <?= $getBodyTileset->created ?></td> <?= $getBodyTileset->modified ?></td> <?= $getBodyTileset->visibility ?></td> <?= $getBodyTileset->description ?></td> <?= $getBodyTileset->filesize ?></td> <?= $getBodyTileset->status ?></td> <?php endforeach; ?> I cannot understand how to access tileset_precisions. The above says [10m] but this data will always change to something different like [5m] or [3cm] or [71.m] etc. How would one best access that data pls?
this data will always change to something different like [5m] or [3cm] or [71.m] etc...yuk. Can you ask whoever created this data to make a more sensible structure? P.S. If you decoded this from JSON, you could ask json_decode to decode it as an associative array, that would make this easier. Failing that, you probably need to look here, or you can try casting the object to an array on-demand