I need to create this in PHP and separate them with commas, in a mysql query.
{
title : 'Property',
image : '1-1-thmb.png',
type : 'For Sale',
price : '$price',
address : '$address',
bedrooms : '$bedrooms',
bathrooms : '$maxguests',
area : '$area',
position : {
lat : 47,
lng : 19
},
markerIcon : 'marker-green.png'
}
Could you please help me how is this possible?
Thanks in advance,
I have tried this:
$map_flats = array(
title => 'Property',
image => '1-1-thmb.png',
type => 'For Sale',
price => $price,
address => $address,
bedrooms => $bedrooms,
bathrooms => $maxguests,
area => $area,
lat => $lat,
lng => $lng,
markerIcon => 'marker-green.png'
);
Tibor
This is a JSON array syntax. You can learn about the JSON notation in the PHP documentation or just try this:
$json = json_encode($obj); // Encodes object properties/array to JSON
$obj = json_decode($json); // Decodes JSON to stdClass object
$arr = json_decode($json, true); // Decodes JSON as array