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

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/09 13:20:11
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

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
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

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
你的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.'
';