作业帮 > 综合 > 作业

PHP数组操作问题Variable passed to each() is not an array or object

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/05/13 02:47:37
PHP数组操作问题Variable passed to each() is not an array or object
$price=array('tires'=>100);$price['oil'] =99;$price['spark plug']=50;
$price['test']=100;
while(list($product,$price)=each($price))
echo $product.'-'.$price.'
';
ERROR:Variable passed to each() is not an array or object
你的list中用了相同的price变量名导致你的price数组被赋值覆盖了.把list中的price改个名字.
==========
$price=array('tires'=>100);$price['oil'] =99;$price['spark plug']=50;
$price['test']=100;
while(list($product,$price_1)=each($price))
echo $product.'-'.$price_1.'
';