php-+与.的关係笔记记录

$shopcart_book_name字串这里需要用.为加的意思
如果foreach的值为字串以+的方式使用会为0
$shopcart_price数字需要用+,
如使用.会以字串的方式去加,如1+1会等于11
在js的世界+是通用的..

$shopcart_book_name;$shopcart_price;foreach ($shopcart as $key => $shopcarts) {$shopcart_book_name = $shopcart_book_name .' '. $shopcarts['book_name'];$shopcart_price = $shopcart_price + $shopcarts['price'];}

关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章