I am trying to get a string out of an array, that I receive from an external API, but so far i haven't had any luck.
This is the array:
stdClass Object
(
[type] => FeatureCollection
[totalFeatures] => 1
[features] => Array
(
[0] => stdClass Object
(
[type] => Feature
[id] => perceel.4304705
[geometry] => stdClass Object
(
[type] => Polygon
[coordinates] => Array
(
[0] => Array
(
[0] => Array
(
[0] => 135608.866
[1] => 444767.317
)
[1] => Array
(
[0] => 135638.627
[1] => 444759.41
)
[2] => Array
(
[0] => 135640.736
[1] => 444758.912
)
[3] => Array
(
[0] => 135642.048
[1] => 444758.752
)
[4] => Array
(
[0] => 135643.376
[1] => 444758.88
)
[5] => Array
(
[0] => 135644.544
[1] => 444759.104
)
[6] => Array
(
[0] => 135645.568
[1] => 444759.552
)
[7] => Array
(
[0] => 135646.512
[1] => 444760.064
)
[8] => Array
(
[0] => 135647.472
[1] => 444760.896
)
[9] => Array
(
[0] => 135648.176
[1] => 444761.664
)
[10] => Array
(
[0] => 135648.72
[1] => 444762.464
)
[11] => Array
(
[0] => 135649.136
[1] => 444763.552
)
[12] => Array
(
[0] => 135650.208
[1] => 444766.528
)
[13] => Array
(
[0] => 135653.968
[1] => 444777.568
)
[14] => Array
(
[0] => 135654.464
[1] => 444779.36
)
[15] => Array
(
[0] => 135660.672
[1] => 444802.784
)
[16] => Array
(
[0] => 135667.088
[1] => 444826.912
)
[17] => Array
(
[0] => 135669.351
[1] => 444835.724
)
[18] => Array
(
[0] => 135673.947
[1] => 444852.99
)
[19] => Array
(
[0] => 135680.226
[1] => 444851.14
)
[20] => Array
(
[0] => 135687.926
[1] => 444871.704
)
[21] => Array
(
[0] => 135688.078
[1] => 444872.023
)
[22] => Array
(
[0] => 135688.056
[1] => 444872.376
)
[23] => Array
(
[0] => 135687.892
[1] => 444872.648
)
[24] => Array
(
[0] => 135687.665
[1] => 444872.796
)
[25] => Array
(
[0] => 135681.376
[1] => 444874.368
)
[26] => Array
(
[0] => 135638.985
[1] => 444885.681
)
[27] => Array
(
[0] => 135624.48
[1] => 444831.424
)
[28] => Array
(
[0] => 135619.072
[1] => 444811.2
)
[29] => Array
(
[0] => 135613.504
[1] => 444790.432
)
[30] => Array
(
[0] => 135607.894
[1] => 444768.679
)
[31] => Array
(
[0] => 135608.866
[1] => 444767.317
)
)
)
)
[geometry_name] => begrenzingperceel
[properties] => stdClass Object
(
[lokaalID] => 340113504
[logischtijdstipOntstaan] => 2009-03-27T23:59:59.000
[logischtijdstipVervallen] =>
[kadastraleGemeenteCode] => VAN00
[sectie] => B
[kadastralegrootte] => 5340
[perceelnummer] => 3857
[perceelnummer_rotatie] => 0
[perceelnummer_deltax] => 0
[perceelnummer_deltay] => 0
[plaatscoordinaten] => stdClass Object
(
[type] => Point
[coordinates] => Array
(
[0] => 135644.749
[1] => 444828.56
)
)
)
)
)
[crs] => stdClass Object
(
[type] => name
[properties] => stdClass Object
(
[name] => urn:ogc:def:crs:EPSG::28992
)
)
)
I am trying to get "[kadastralegrootte] => 5340", and than only the "5340" part.
I have tried something like this:
$json = json_decode($result, true);
$grootte = $json->features->properties->kadastralegrootte;
echo "$grootte";
Where $result is a json file. So far no luck. I would really appreciate it if someone took a look.