Home > Net >  Looping Through array from json responce using foreach loop
Looping Through array from json responce using foreach loop

Time:09-11

i called an API and used JSON decode to get array result of the response using the code belodw

<?php

$url = "*******************************";

$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$headers = array(
   "Authorization: Bearer ************************************N2VlODFjMTkwNg",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);

$resp = curl_exec($curl);
curl_close($curl);



$decode = json_decode($resp, true, JSON_UNESCAPED_SLASHES);

var_dump($decode);

?>

My result displays as the code below

    array(2) {
  ["error"] => string(0)
  "" ["result"] => array(3) {
    ["property"] => array(54) {
      ["PROPERTY_ID"] => string(6)
      "253424" ["SALE_RENT"] => string(1)
      "S" ["PROP_SUB_TYPE_ID"] => string(1)
      "2" ["PROP_TYPE_NAME"] => string(5)
      "Konut" ["DISPLAY_NAME"] => string(13)
      "Intendox LTD" ["CONTACT_NAME1"] => string(14)
      "Stella Istradi" ["PROP_SUB_TYPE_NAME"] => string(5)
      "Daire" ["PROP_SUB_TYPE_NAME_EN"] => string(4)
      "Flat" ["CITY_NAME"] => string(5)
      "Girne" ["TITLE_TYPE_ID"] => string(1)
      "1" ["REFERENCE_NO"] => string(0)
      "" ["TITLE_NAME"] => string(15)
      "Türk Koçanlı" ["CITY_EN"] => string(7)
      "Kyrenia" ["CITY_ID"] => string(1)
      "2" ["DISTRICT_NAME"] => string(8)
      "Alsancak" ["DISTRICT_ID"] => string(1)
      "6" ["PROPERTY_NAME"] => string(39)
      "2 1NEW FLATS IN ALSANGAK NEAR THE BEACH" ["PROPERTY_NAME_EN"] => string(43)
      "2 1NEW FLATS IN ALSANGAK NEAR THE BEACH ** " ["CURRENCY_ICON"] => string(2)
      "£" ["CURRENCY_ID"] => string(1)
      "1" ["PRICE"] => string(6)
      "100000" ["PRICE_FORMATTED"] => string(7)
      "100,000" ["STATUS"] => string(1)
      "P" ["PRICE_TYPE"] => string(1)
      "T" ["FURNISH_STATE"] => string(14)
      "Yarı Eşyalı" ["FURNISH_STATE_ID"] => string(1)
      "2" ["FREQ_NAME"] => string(6)
      "Aylık" ["BEDROOM"] => string(1)
      "2" ["BATHROOM"] => string(1)
      "1" ["M2"] => string(2)
      "84" ["USER_ID"] => string(5)
      "14624" ["INSERT_DATE_FORMATTED"] => string(10)
      "18/07/2022" ["UPDATE_DATE_FORMATTED"] => string(10)
      "28/07/2022" ["TL_PRICE"] => string(12)
      "2138800.0000" ["BUILDING_AGE_TEXT"] => string(1)
      "0" ["BUILDING_AGE_ID"] => string(2)
      "10" ["PROPERTY_DESC"] => string(119)
      "FOR SALE NEW APARTMENTS CLOSE TO THE MARMONTE BEACH !!! FIRST FLOOR WITH THE GARDEN SECOND WITH TERRACE AND BARBECUE!!!" ["PROPERTY_DESC_EN"] => string(127)
      "FOR SALE NEW APARTMENTS CLOSE TO THE MARMONTE BEACH !!! FIRST FLOOR WITH THE GARDEN SECOND WITH TERRACE AND BARBECUE!!! **AT** " ["SHOW_MAP"] => string(1)
      "0" ["PROP_TYPE_ID"] => string(1)
      "1" ["GEO_LATITUDE"] => string(0)
      "" ["GEO_LONGITUDE"] => string(0)
      "" ["ROOM_TYPE_ID"] => string(1)
      "3" ["ROOM_TYPE_TEXT"] => string(3)
      "2 1" ["SALE_RENT_TEXT"] => string(9)
      "Satılık" ["S_R"] => string(1)
      "S" ["PROFILE_URL"] => string(12)
      "intendox-ltd" ["FLOOR"] => string(1)
      "1" ["FLOOR_COUNT"] => string(1)
      "2" ["DEVELOPMENT_RATE"] => string(1)
      "0" ["FLOOR_PERMISSION"] => string(1)
      "0" ["HOUSE_LAND_SIZE"] => string(3)
      "250" ["USER_AGENT_ID"] => string(4)
      "3188" ["MEMBER_KTEB"] => string(1)
      "N"
    } ["images"] => array(20) {
      [0] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518571" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137613.6374.jpeg" ["FILE_SIZE"] => string(3)
        "118" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "1" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:46:53" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137613.6374.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137613.6374.jpeg"
      } [1] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518572" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137615.8337.jpeg" ["FILE_SIZE"] => string(2)
        "85" ["IMAGE_DIMENSIONS"] => string(8)
        "607x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "2" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:46:56" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137615.8337.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137615.8337.jpeg"
      } [2] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518573" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137618.5905.jpeg" ["FILE_SIZE"] => string(2)
        "96" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "3" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:46:58" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137618.5905.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137618.5905.jpeg"
      } [3] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518574" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137621.1575.jpeg" ["FILE_SIZE"] => string(2)
        "76" ["IMAGE_DIMENSIONS"] => string(8)
        "607x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "4" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:01" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137621.1575.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137621.1575.jpeg"
      } [4] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518575" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137624.0395.jpeg" ["FILE_SIZE"] => string(2)
        "92" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "5" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:04" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137624.0395.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137624.0395.jpeg"
      } [5] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518576" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(55)
        "girne-alsancak-satilik-daire-253424-1658137626.531.jpeg" ["FILE_SIZE"] => string(3)
        "111" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "6" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:06" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(143)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137626.531.jpeg" ["wm_url"] => string(140)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137626.531.jpeg"
      } [6] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518577" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137629.0212.jpeg" ["FILE_SIZE"] => string(3)
        "117" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "7" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:09" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137629.0212.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137629.0212.jpeg"
      } [7] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518578" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137631.3465.jpeg" ["FILE_SIZE"] => string(2)
        "95" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "8" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:11" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137631.3465.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137631.3465.jpeg"
      } [8] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518579" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137635.3597.jpeg" ["FILE_SIZE"] => string(2)
        "93" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(1)
        "9" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:16" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137635.3597.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137635.3597.jpeg"
      } [9] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518580" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137638.0009.jpeg" ["FILE_SIZE"] => string(3)
        "117" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "10" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:18" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137638.0009.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137638.0009.jpeg"
      } [10] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518581" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137639.7696.jpeg" ["FILE_SIZE"] => string(2)
        "74" ["IMAGE_DIMENSIONS"] => string(8)
        "607x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "11" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:19" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137639.7696.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137639.7696.jpeg"
      } [11] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518582" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137641.8043.jpeg" ["FILE_SIZE"] => string(2)
        "77" ["IMAGE_DIMENSIONS"] => string(8)
        "607x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "12" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:22" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137641.8043.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137641.8043.jpeg"
      } [12] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518583" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137644.0571.jpeg" ["FILE_SIZE"] => string(3)
        "111" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "13" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:24" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137644.0571.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137644.0571.jpeg"
      } [13] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518584" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137649.2687.jpeg" ["FILE_SIZE"] => string(3)
        "129" ["IMAGE_DIMENSIONS"] => string(8)
        "1280x843" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "14" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:29" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137649.2687.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137649.2687.jpeg"
      } [14] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518585" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137651.5859.jpeg" ["FILE_SIZE"] => string(2)
        "77" ["IMAGE_DIMENSIONS"] => string(8)
        "810x1080" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "15" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:31" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137651.5859.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137651.5859.jpeg"
      } [15] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518586" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137654.1785.jpeg" ["FILE_SIZE"] => string(3)
        "160" ["IMAGE_DIMENSIONS"] => string(8)
        "1280x960" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "16" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:34" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137654.1785.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137654.1785.jpeg"
      } [16] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518587" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137656.7826.jpeg" ["FILE_SIZE"] => string(3)
        "135" ["IMAGE_DIMENSIONS"] => string(8)
        "1280x960" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "17" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:37" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137656.7826.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137656.7826.jpeg"
      } [17] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518588" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137658.8182.jpeg" ["FILE_SIZE"] => string(3)
        "170" ["IMAGE_DIMENSIONS"] => string(8)
        "1280x583" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "18" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:39" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137658.8182.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137658.8182.jpeg"
      } [18] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518589" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137661.4831.jpeg" ["FILE_SIZE"] => string(3)
        "183" ["IMAGE_DIMENSIONS"] => string(8)
        "1280x960" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "19" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:41" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137661.4831.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137661.4831.jpeg"
      } [19] => array(11) {
        ["PROP_PICTURE_ID"] => string(7)
        "2518590" ["PROPERTY_ID"] => string(6)
        "253424" ["PICTURE_PATH"] => string(56)
        "girne-alsancak-satilik-daire-253424-1658137663.4862.jpeg" ["FILE_SIZE"] => string(2)
        "99" ["IMAGE_DIMENSIONS"] => string(8)
        "1280x849" ["THUMBNAIL"] => string(1)
        "0" ["ORDER_BY"] => string(2)
        "20" ["UPLOAD_DATE"] => string(19)
        "2022-07-18 12:47:43" ["REGENERATE_THUMBNAIL"] => string(1)
        "0" ["thumb_url"] => string(144)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_thumb/14624/253424/girne-alsancak-satilik-daire-253424-1658137663.4862.jpeg" ["wm_url"] => string(141)
        "https://101evler-cdn.s3.eu-central-1.amazonaws.com/property/property_wm/14624/253424/girne-alsancak-satilik-daire-253424-1658137663.4862.jpeg"
      }
    } ["specifications"] => array(1) {
      [0] => array(58) {
        ["SPEC_ID"] => string(6)
        "177052" ["PROPERTY_ID"] => string(6)
        "253424" ["BUILTIN_KITCHEN"] => string(1)
        "0" ["BALCONY"] => string(1)
        "0" ["BATH_CHECK"] => string(1)
        "0" ["LAUNDRY"] => string(1)
        "0" ["STEEL_DOOR"] => string(1)
        "1" ["ENTRYPHONE"] => string(1)
        "0" ["NATURAL_MARBLE"] => string(1)
        "0" ["SHOWER"] => string(1)
        "0" ["WALLPAPER"] => string(1)
        "0" ["MASTER_CABINNET"] => string(1)
        "0" ["MASTER_BATH"] => string(1)
        "0" ["CLOSET"] => string(1)
        "0" ["AC"] => string(1)
        "0" ["PANEL_DOOR"] => string(1)
        "0" ["BLIND"] => string(1)
        "0" ["PARQUET"] => string(1)
        "0" ["FIREPLACE"] => string(1)
        "0" ["TV_INFRASTRUCTURE"] => string(1)
        "0" ["VESTIYER"] => string(1)
        "0" ["FIRE_ALARM"] => string(1)
        "0" ["LIFT"] => string(1)
        "0" ["MOUNTAIN_VIEW"] => string(1)
        "1" ["SEA_VIEW"] => string(1)
        "1" ["SEA_FRONT"] => string(1)
        "1" ["WATER_BOOSTER"] => string(1)
        "0" ["THERMAL_INSULATION"] => string(1)
        "0" ["PARK"] => string(1)
        "1" ["WATER_TANK"] => string(1)
        "1" ["SECURITY_CAM"] => string(1)
        "0" ["CLOSED_PARK"] => string(1)
        "0" ["BOUNDING_WALL"] => string(1)
        "0" ["GARAGE"] => string(1)
        "0" ["TERRACE"] => string(1)
        "1" ["GARDEN"] => string(1)
        "1" ["PUBLIC_POOL"] => string(1)
        "0" ["PRIVATE_POOL"] => string(1)
        "1" ["ELECTRICAL_INFRASTRUCTURE"] => string(1)
        "0" ["WATER_INFRASTRUCTURE"] => string(1)
        "0" ["ROAD"] => string(1)
        "0" ["IN_CITY"] => string(1)
        "0" ["SU_KUYUSU"] => string(1)
        "0" ["CIFT_CAM"] => string(1)
        "0" ["SOLAR_ELECTRIC"] => string(1)
        "0" ["CITY_VIEW"] => string(1)
        "0" ["SARI_TAS"] => string(1)
        "0" ["LOFT_SENDE_KAT"] => string(1)
        "0" ["KEPENK"] => string(1)
        "0" ["BARBEKU"] => string(1)
        "1" ["KARTONPIYER"] => string(1)
        "0" ["NATURE_VIEW"] => string(1)
        "0" ["GENERATOR"] => string(1)
        "0" ["PANTRY"] => string(1)
        "0" ["NORTH_FACE"] => string(1)
        "0" ["SOUTH_FACE"] => string(1)
        "0" ["EAST_FACE"] => string(1)
        "0" ["WEST_FACE"] => string(1)
        "0"
      }
    }
  }
}

i used:

$propertys = array();
foreach ($decode->result as $result) {
  foreach ($result->property as $data) {
    $property['id'] = $data->PROPERTY_ID;
    $property['sale'] = $data->SALE_RENT;
    $propertys[] = $property;
  }
}

for printing just the property id for a test but for some reason i cant get any of the variable results. i have tried single foreach loop and multiple but cant access the data. any help on how i go about this?

CodePudding user response:

It is objects that can be accessed with the PHP arrow operator (->). Elements of associative arrays cannot be accessed with the arrow operator.

Try the following:

$data = $decode['result']['property'];
$property['id'] = $data['PROPERTY_ID'];
$property['sale'] = $data['SALE_RENT'];
print_r($property['id']);
  • Related