Jump to content

Removing value from echo


Andrew R

Recommended Posts

Sorry for the badly described topic, don't know how else to explain it  :)

 

For example.  If had the following coordinates in the database:

 

-5.717979 54.728432,-5.672246 54.757900,-5.621388 54.786976,

 

If I then echo them how would I remove the , (comma) at the end?  As I will echoing multiple coordinates from the database, some longer than others I can't simply remove the comma after a certin about numbers.

 

Any help would be appreciated. 

 

Cheers  :)

Link to comment
https://forums.phpfreaks.com/topic/70160-removing-value-from-echo/
Share on other sites

Thanks  :)

 

Tryed this, doesn't seem to work though:

 

<?php 
$total = "-5.717979 54.728432,-5.672246 54.757900,-5.621388 54.786976,-5.564545 54.816902,-5.502621 54.848289,-5.436880 54.881577,-5.370000 54.915535,-5.302828 54.949612,-5.234945 54.984013,-5.166701 55.018578,";

$result = explode("$total,", $total);

echo $result[0];

php?>

 

It should select all values excluding the last comma?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.