Unwanted quotation marks


#1
<?php
$user= "secret";
$password= "secret";
$dsn = 'mysql:host=localhost;dbname=also_secret';
$conn = new PDO($dsn,$user,$password);
if (!$conn) {
	echo 'no connection';
	exit;
}
$sql = 'SELECT * FROM pokestops ORDER BY id LIMIT 0,1000';
$rs = $conn->query($sql);
if (!$rs) {
    echo 'An SQL error occured.';
    exit;
}
$geojson = array (
	'type'	=> 'FeatureCollection',
	'features'	=> array()
);
while ($row = $rs->fetch(PDO::FETCH_ASSOC)) {

	$feature = array(
		'type'	=> 'Feature',
		'geometry' => array(
			'type' => 'Point',
			'coordinates' => array(
					$row['lon'],
					$row['lat']
					)	
			),
		'properties' => array(
            'name' => $row['pokestop_name'],
            'address'=> $row['address'],
            ),
	);
	array_push($geojson['features'], $feature);
}
header('Content-type: application/json');
echo json_encode($geojson, JSON_PRETTY_PRINT);
//for local json files use code below
/*$fp = fopen('data.json', 'w');
fwrite($fp, geoJson($json));
fclose($fp);*/
$conn = NULL;
?>

this results in a geojson file , but the lat & lon under coordinates are in quotation marks, this is giving errors.

does someone have a solution


#2

Do you mean you want to remove quotes and double-quotes from the string?
You can do it this way:

trim(trim($string,"’"),’"’); //removes the single as well as double quotes from start and end