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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.