开发者

PHP add elements together but not Maths

开发者 https://www.devze.com 2023-04-05 18:10 出处:网络
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.

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

精彩评论

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