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?
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
i'm new in twig. I had read the twig documentation but can nt find solution, as it is much easier in PHP. ((Trying two array in one loop.))
: i have two arrays one is {{ dump(render_categories) }}--
array(3) {
[0] => array(3) {
[0] => array(2) {
["category_id"] => string(2)
"65" ["name"] => string(11)
"Annivarsary"
} [1] => array(2) {
["category_id"] => string(2)
"67" ["name"] => string(9)
"Christmas"
} [2] => array(2) {
["category_id"] => string(2)
"66" ["name"] => string(8)
"Birthday"
}
} [1] => array(4) {
[0] => array(2) {
["category_id"] => string(2)
"61" ["name"] => string(6)
"Mother"
} [1] => array(2) {
["category_id"] => string(2)
"62" ["name"] => string(6)
"Sister"
} [2] => array(2) {
["category_id"] => string(2)
"60" ["name"] => string(8)
"Daughter"
} [3] => array(2) {
["category_id"] => string(2)
"63" ["name"] => string(10)
"Girlfriend"
}
} [2] => array(5) {
[0] => array(2) {
["category_id"] => string(2)
"73" ["name"] => string(8)
"Earrings"
} [1] => array(2) {
["category_id"] => string(2)
"72" ["name"] => string(22)
"Necklaces&Pendants"
} [2] => array(2) {
["category_id"] => string(2)
"71" ["name"] => string(5)
"Rings"
} [3] => array(2) {
["category_id"] => string(2)
"70" ["name"] => string(9)
"Bracelets"
} [4] => array(2) {
["category_id"] => string(2)
"69" ["name"] => string(6)
"Charms"
}
}
}
Second is {{ dump(load_steps) }} : (of different length)
array(3) {
[0] => array(4) {
["id"] => string(1)
"1" ["category_id"] => string(2)
"64" ["heading"] => string(21)
"What is the occasion?" ["status"] => string(1)
"1"
} [1] => array(4) {
["id"] => string(1)
"2" ["category_id"] => string(2)
"59" ["heading"] => string(5)
"For which Person" ["status"] => string(1)
"1"
} [2] => array(4) {
["id"] => string(1)
"3" ["category_id"] => string(2)
"68" ["heading"] => string(24)
"Type text heading 878787" ["status"] => string(1)
"1"
}
}
I'm trying to get Output like:
What is the occasion? --(get from second array)--
Annivarsary, Christmas, Birthday --(get from First array)--
For which Person? --(get from second array)--
Mother, Sister, Daughter, Girlfriend --(get from First array)--
------So, on-----
Any help is appreciated, ThankYou.
Wouldn't this do the trick ?
{% for key, step in load_steps %}
{{ step['heading'] }}
{% for category in render_categories[key] %}
{{ category['name'] }}
{% endfor %}
{% endfor %}
$db_a = new PDO("odbc:MYOB",'user','pass');
foreach($db_a->query("SELECT * FROM Sale WHERE SaleID = 108605") as $row) {
echo '<pre>';
print_r($row);
echo '</pre>';
}
This returns all the table column titles as well as the first five results but everything after that is blank. I've tried issuing the same select statement through MS access and it works correctly
Array
(
[ItemSaleLineID] => 1605696
[0] => 1605696
[SaleLineID] => 1605696
[1] => 1605696
[SaleID] => 108605
[2] => 108605
[LineNumber] => 1
[3] => 1
[LineTypeID] => D
[4] => D
[Description] =>
[5] =>
[TaxExclusiveTotal] =>
[6] =>
[TaxInclusiveTotal] =>
[7] =>
[TaxCodeID] =>
[8] =>
[JobID] =>
[9] =>
[IsMultipleJob] =>
[10] =>
[Quantity] =>
[11] =>
[ItemID] =>
[12] =>
[TaxExclusiveUnitPrice] =>
[13] =>
[TaxInclusiveUnitPrice] =>
[14] =>
[Discount] =>
[15] =>
[CostOfGoodsSoldAmount] =>
[16] =>
[LocationID] =>
[17] =>
[Kit/ComponentIndicator] =>
[18] =>
)
Output from var_dump:
array(20) { ["SaleLineID"]=> string(7) "1605696" [0]=> string(7) "1605696" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "1" [2]=> string(1) "1" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL } array(20) { ["SaleLineID"]=> string(7) "1605697" [0]=> string(7) "1605697" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "2" [2]=> string(1) "2" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL } array(20) { ["SaleLineID"]=> string(7) "1605698" [0]=> string(7) "1605698" ["SaleID"]=> string(6) "108605" [1]=> string(6) "108605" ["LineNumber"]=> string(1) "3" [2]=> string(1) "3" ["LineTypeID"]=> string(1) "D" [3]=> string(1) "D" ["Description"]=> NULL [4]=> NULL ["TaxExclusiveAmount"]=> NULL [5]=> NULL ["TaxInclusiveAmount"]=> NULL [6]=> NULL ["TaxCodeID"]=> NULL [7]=> NULL ["JobID"]=> NULL [8]=> NULL ["IsMultipleJob"]=> NULL [9]=> NULL }
I'm working on a project with an API.
I gather data from a form and send this to their website.
The data is gathered through an array and then encoded to json format:
$pers_payload = array(
'gender' => 'Unknown', //or Male / Female
'first_name' => $_POST['billing_first_name'],
'family_name' => $_POST ['billing_last_name'],
'email' => $_POST['billing_email'],
'linked_as_contact_to_organization' => array(
array(
'organization_id' => $organization_id, // add the person as a contact to the newly created organization
'work_email' => $_POST['billing_email'],
'work_phone' => $_POST['billing_phone']
)
),
'visiting_address' => array(
'country_code' => 'NL'
), // can be extented with other address data
'postal_address' => array(
'country_code' => $_POST['billing_country']
) // can be extented with other address data
);
Then the post request.
$person = $SimplicateApi->makeApiCall('POST','/crm/person',json_encode($pers_payload));
}
I can also do a get request, this get request returns a multi dimensional array:
$tet = $SimplicateApi->makeApiCall('GET','/crm/person?q[first_name]=Kevin1');
If i do a var_dump on $tet i get this:
array(3) {
["data"] => array(2) {
[0] => array(11) {
["id"] => string(39)
"person:067af3bd2045824e62ac579e634623b8" ["interests"] => array(1) {
[0] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:f278f47e6e9d48b8" ["name"] => string(19)
"Actief in Duitsland"
}
}["simplicate_url"] => string(51)
"https://emark.simplicate.nl/crm/person/view?id=3552" ["avatar"] => array(2) {
["initials"] => string(2)
"Kt" ["color"] => string(7)
"#03e084"
}["linked_as_contact_to_organization"] => array(1) {
[0] => array(7) {
["id"] => string(46)
"contactperson:0f16f418f1845749c79bebf9e1e753e5" ["organization_id"] => string(45)
"organization:8632b86ba41637262e0871767f96f43e" ["name"] => string(9)
"testing12" ["work_email"] => string(24)
"ma#e-marketingsupport.nl" ["work_phone"] => string(8)
"06269684" ["work_mobile"] => string(8)
"06269684" ["interests"] => array(16) {
[0] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:456e8b19c0079647" ["name"] => string(11)
"Twinkle 100"
}[1] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:a70e69b83382e85a" ["name"] => string(17)
"Bekend merk in NL"
}[2] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:ce50f1b5593ac180" ["name"] => string(15)
"Cross Border 30"
}[3] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:f40eca1b281969d6" ["name"] => string(20)
"Meerdere vestigingen"
}[4] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:7435d7409a07cefb" ["name"] => string(26)
"Meer dan 100k in Duitsland"
}[5] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:cc072cea856ea23a" ["name"] => string(17)
"B2B leadgeneratie"
}[6] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:f278f47e6e9d48b8" ["name"] => string(19)
"Actief in Duitsland"
}[7] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:9bbeb23d17283595" ["name"] => string(10)
"Exporteert"
}[8] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:97ed988af66b1abc" ["name"] => string(8)
"Debiteur"
}[9] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:3e31ffca2394bc38e1bb3149bee8b668" ["name"] => string(9)
"Marketing"
}[10] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:706fa5fa92c56081e1bb3149bee8b668" ["name"] => string(6)
"Amazon"
}[11] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:05f1a5da1c4c7df2e1bb3149bee8b668" ["name"] => string(3)
"Jur"
}[12] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:477554ee16a0c738e1bb3149bee8b668" ["name"] => string(11)
"Vertalingen"
}[13] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:f5f1b7512245a3b5e1bb3149bee8b668" ["name"] => string(5)
"Adres"
}[14] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:d1123dfaa0073c82e1bb3149bee8b668" ["name"] => string(4)
"GmbH"
}[15] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:7d3458131ea89afbe1bb3149bee8b668" ["name"] => string(3)
"Web"
}
}
}
}["gender"] => string(7)
"Unknown" ["first_name"] => string(6)
"Kevin1" ["family_name"] => string(7)
"testing" ["full_name"] => string(14)
"Kevin1 testing" ["email"] => string(24)
"ma#e-marketingsupport.nl" ["phone"] => string(8)
"06269684"
}[1] => array(11) {
["id"] => string(39)
"person:067af3bd2045824ea8c16e7ea0baf9d6" ["interests"] => array(1) {
[0] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:f278f47e6e9d48b8" ["name"] => string(19)
"Actief in Duitsland"
}
}["simplicate_url"] => string(51)
"https://emark.simplicate.nl/crm/person/view?id=3553" ["avatar"] => array(2) {
["initials"] => string(2)
"Kt" ["color"] => string(7)
"#dce1f3"
}["linked_as_contact_to_organization"] => array(1) {
[0] => array(7) {
["id"] => string(46)
"contactperson:f48fdcaaff0211e728a2e4ccf197900b" ["organization_id"] => string(45)
"organization:8632b86ba41637262e0871767f96f43e" ["name"] => string(9)
"testing12" ["work_email"] => string(24)
"ma#e-marketingsupport.nl" ["work_phone"] => string(8)
"06269684" ["work_mobile"] => string(8)
"06269684" ["interests"] => array(16) {
[0] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:456e8b19c0079647" ["name"] => string(11)
"Twinkle 100"
}[1] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:a70e69b83382e85a" ["name"] => string(17)
"Bekend merk in NL"
}[2] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:ce50f1b5593ac180" ["name"] => string(15)
"Cross Border 30"
}[3] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:f40eca1b281969d6" ["name"] => string(20)
"Meerdere vestigingen"
}[4] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:7435d7409a07cefb" ["name"] => string(26)
"Meer dan 100k in Duitsland"
}[5] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:cc072cea856ea23a" ["name"] => string(17)
"B2B leadgeneratie"
}[6] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:f278f47e6e9d48b8" ["name"] => string(19)
"Actief in Duitsland"
}[7] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:9bbeb23d17283595" ["name"] => string(10)
"Exporteert"
}[8] => array(3) {
["value"] => bool(false)["id"] => string(25)
"interest:97ed988af66b1abc" ["name"] => string(8)
"Debiteur"
}[9] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:3e31ffca2394bc38e1bb3149bee8b668" ["name"] => string(9)
"Marketing"
}[10] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:706fa5fa92c56081e1bb3149bee8b668" ["name"] => string(6)
"Amazon"
}[11] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:05f1a5da1c4c7df2e1bb3149bee8b668" ["name"] => string(3)
"Jur"
}[12] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:477554ee16a0c738e1bb3149bee8b668" ["name"] => string(11)
"Vertalingen"
}[13] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:f5f1b7512245a3b5e1bb3149bee8b668" ["name"] => string(5)
"Adres"
}[14] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:d1123dfaa0073c82e1bb3149bee8b668" ["name"] => string(4)
"GmbH"
}[15] => array(3) {
["value"] => bool(false)["id"] => string(41)
"interest:7d3458131ea89afbe1bb3149bee8b668" ["name"] => string(3)
"Web"
}
}
}
}["gender"] => string(7)
"Unknown" ["first_name"] => string(6)
"Kevin1" ["family_name"] => string(7)
"testing" ["full_name"] => string(14)
"Kevin1 testing" ["email"] => string(24)
"ma#e-marketingsupport.nl" ["phone"] => string(8)
"06269684"
}
}["errors"] => NULL["debug"] => NULL
}
I dont want double values. For example if 'first_name' => $_POST['billing_first_name'],(in the $pers_payload variable) exists in $tet as a value. then dont run
$person = $SimplicateApi->makeApiCall('POST','/crm/person',json_encode($pers_payload));
}
else run:
$person = $SimplicateApi->makeApiCall('POST','/crm/person',json_encode($pers_payload));
}
I tried this from another question i asked:
foreach (array_keys($tet['data']) as $key) {
if (array_key_exists('first_name', $tet['data'][$key])
&& (strcasecmp($tet['data'][$key]['first_name'], 'Kevin1') == 0) ) {
echo "found key 'first_name' with value '" . $tet['data'][$key]['first_name'] . "'\n";
} else {
// perform your post request
$person = $SimplicateApi->makeApiCall('POST','/crm/person',json_encode($pers_payload));
}
}
This doesn't run the post request at all even if the value of first_name doesnt exist
I found the solution.
I accomplished this with a simple if statement:
if(strtolower($_POST['billing_last_name']) == strtolower($getOrg['data']['0']['linked_persons_contacts']['0']['family_name'])) {
// do nothing
} else {
$person = $SimplicateApi->makeApiCall('POST','/crm/person',json_encode($pers_payload));
}
How to extract this multi dimensional array from php. I am using codeigniter framework.
array(2) {
[0] => array(14)
{
["Key"] =>
string(48) "32;FaXmBQJ7/0MATwBVAFAAMAAxADIAOA==9;1261414580;"
["Type"] => string(12) "Store_Coupon"
["Code"] => string(8) "COUP0128"
["Coupon_Issuer"] => string(2) "11"
["Coupon_Reference_No"] => string(1) "1"
["Description"] => string(5) "test2"
["Price_Group"] => string(3) "ALL"
["Discount_Type"] => string(15) "Discount_Amount"
["Discount_Value"] => string(1) "0"
["Validation_Period_ID"] => string(2) "14"
["Validation_Description"] => string(15) "2016 membership"
["Starting_Date"] => string(10) "2016-01-01"
["Ending_Date"] => string(10) "2016-12-31"
["Status"] => string(8) "Disabled"
}
[1] => array(14)
{
["Key"] => string(48) "32;FaXmBQJ7/0MATwBVAFAATwBOADAAMg==9;1261413680;"
["Type"] => string(12) "Store_Coupon"
["Code"] => string(8) "COUPON02"
["Coupon_Issuer"] => string(2) "11"
["Coupon_Reference_No"] => string(1) "2"
["Description"] => string(6) "test 3"
["Price_Group"] => string(3) "ALL"
["Discount_Type"] => string(16) "Discount_Percent"
["Discount_Value"] => string(1) "0"
["Validation_Period_ID"] => string(2) "14"
["Validation_Description"] => string(15) "2016 membership"
["Starting_Date"] => string(10) "2016-01-01"
["Ending_Date"] => string(10) "2016-12-31"["Status"] => string(8) "Disabled"
}
}
I want to extract Coupon_Reference_No element. Thanks in advance
Just do a foreach and store that variable in an array. Supposing your aray is $array
$Coupon_Reference_No = array();
foreach($array as $key=>$value){
if($key == 'Coupon_Reference_No'){
$Coupon_Reference_No[] = $value;
}
}
You will get an array $Coupon_Reference_No as array("1","2")
I have this kind of array:
array(2) {
[1] => array(3) {
[3] => array(3) {
["data"] => array(3) {
["id"] => string(1) "3"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
[4] => array(3) {
["data"] => array(3) {
["id"] => string(1) "4"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
[2] => array(3) {
["data"] => array(3) {
["id"] => string(1) "2"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
}
[2] => &array(3) {
[15] => array(3) {
["data"] => array(3) {
["id"] => string(2) "15"
["depth"] => string(1) "2"
["parent_id"] => string(1) "3"
}
}
[16] => array(3) {
["data"] => array(3) {
["id"] => string(2) "16"
["depth"] => string(1) "2"
["parent_id"] => string(1) "2"
}
}
[18] => array(3) {
["data"] => array(3) {
["id"] => string(2) "18"
["depth"] => string(1) "2"
["parent_id"] => string(1) "4"
}
}
}
}
First level means depth (1 hasn't child, 2 has parent without child, etc.). Order of array items is correct. I need obtain different array in the same order (of course in dependency of level).
array(6) {
[3] => array(3) {
["data"] => array(3) {
["id"] => string(1) "3"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
[15] => array(3) {
["data"] => array(3) {
["id"] => string(1) "15"
["depth"] => string(1) "1"
["parent_id"] => 3
}
}
[4] => array(3) {
["data"] => array(3) {
["id"] => string(1) "4"
["depth"] => string(1) "1"
["parent_id"] => NULL
}
}
[18] => &array(3) {
["data"] => array(3) {
["id"] => string(2) "18"
["depth"] => string(1) "2"
["parent_id"] => string(1) "4"
}
}
[2] => array(3) {
["data"] => array(3) {
["id"] => string(2) "2"
["depth"] => string(1) "2"
["parent_id"] => NULL
}
}
[16] => array(3) {
["data"] => array(3) {
["id"] => string(2) "16"
["depth"] => string(1) "2"
["parent_id"] => string(1) "2"
}
}
}
**
First solution
**
I found solution but I do not know how make recursion from that. It works only with two levels. Third level is order badly. Variable $this->hierarchicalData contains first array.
$_sortedHierarchyData = array();
foreach ($this->hierarchicalData as $levelKey => $_level) {
foreach ($_level as $itemKey => $item) {
if (isset($this->hierarchicalData[$levelKey + 1])) {
$_sortedHierarchyData[$item['data']['id']] = $item;
$children = $this->searchChildrenFromLevelOfHieararchicalSortedData($item['data']['id'], $this->hierarchicalData[$levelKey + 1]);
$_sortedHierarchyData += $children;
}
}
}
function searchChildrenFromLevelOfHieararchicalSortedData($parent_id, $level)
{
$_children = array();
foreach ($level as $key => $item) {
if ($item['data']['parent_id'] === $parent_id) {
$_children[$key] = $item;
}
}
return $_children;
}