I am trying to add a series of numbers to a string, but not add them up. The following code is adding the numbers up and giving me the result. I want it to simple add them to the string.
<?php foreach ($directions as $direct) {
$latitude = $direct->start_location->lat;
$longitude = $direct->start_location->lng;
$dirco开发者_如何学Pythonrds += $latitude.','.$longitude.'|';
}?><?php echo $dircords?>
Any ideas?
Marvellous
Use .=
instead of +=
.
.
is the string concatenation operator. +
is for additions.
See String operators.
精彩评论