开发者

PHP add elements together but not Maths

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜