$s = floatval("-2.1123423897498E+28");
echo number_format($s); //-21,123,423,897,497,998,933,557,772,288
class Sorter {
constructor() {
this.array = [];
}
add(element) {
this.array[this.array.length+1]=element;
return this.array.length+1;
}
}
var arr = [
{ID: "123", lat: "55.680024", lng: "37.558505"},
{ID: "123", lat: "55.680024", lng: "37.558505"},
{ID: "987", lat: "55.783861", lng: "37.536533"},
{ID: "987", lat: "55.783861", lng: "37.536533"}
];
console.log( convert(arr));
function convert(arr){
var newarr = [];
arr.map((e)=>{
for(var i = 0;i < newarr.length;i++)
if(newarr[i].ID == e.ID){
newarr[i].Coords.push({lat:e.lat,lng:e.lng});
return;
}
newarr.push({ID:e.ID,Coords:[{lat:e.lat,lng:e.lng}]});
});
return newarr;
}
<script>
window.onload = function(){
document.all.selec.onchange = function(){
document.all.sys.setAttribute("action",this.value);
}
}
</script>
<form method="post" id="sys" action="link.php">
<p><select id="selec" >
<option value=''>Choose</option>
<option value="1" >1</option>
<option value="2" >2</option>
</select></p>
</form>