1 2 3 4 5 6 7 8 9 10 11
| <?php
$test = '<?xml version="1.0" encoding="utf-8"?><kml xmlns="http://www.opengis.net/kml/2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:kmlx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
<Document><Placemark><name>230711</name><Style><LineStyle><color>ff0000ff</color><width>4</width></LineStyle></Style><MultiGeometry><LineString>
<coordinates>13.899752693250775,45.892274044454098,117.42 13.89977197162807,45.892190644517541,127.511 13.899703072384,45.892093246802688,114.53 13.899721931666136,45.892145046964288,120.3 13.89972997829318,45.892167929559946,118.86 13.899664767086506,45.892155189067125,118.86 13.899780185893178,45.891889231279492,116.94 13.900160808116198,45.891253044828773,113.569 13.900176901370287,45.89123385027051,114.05 13.900233143940568,45.891218595206738,116.459 13.900235071778297,45.891235191375017,121.739 13.900240268558264,45.891239885240793,118.38 13.9002366643399,45.8912050165236,124.151 13.900237921625376,45.891200825572014,120.78 13.900223672389984,45.891221025958657,120.78 13.90019073151052,45.891234437003732,124.151 13.900200622156262...';
$resultat = preg_replace(
'#(\d+).(\d{3})(\d+)#' // \d représente un chiffre
, '$1.$2'
, $test
); |
Partager