您好,欢迎访问一九零五行业门户网

$line[一] = intval($line[1]); //这个这样写是什么意思

$line[1] = intval($line[1]); //这个这样写是什么意思?
bob's auto parts - customer orders
bob's auto parts
customer orders
//read in the entire file.
//each order becomes an element in the array
$orders= file($document_root/../orders/orders.txt);
// count the number of orders in the array
$number_of_orders = count($orders);
if ($number_of_orders == 0) {
echo no orders pending.
please try again later.
;
}
echo \n;
echo order date
tires
oil
spark plugs
total
address
;
for ($i=0; $i

$line[1] = intval($line[1]); //这个这样写是什么意思? intval手册是这样描述intval通过使用特定的进制转换(默认是十进制),返回变量 var 的 integer 数值。但是将这个integer数值赋给$line[1]起到什么作用?
分享到: 更多
------解决方案--------------------
intval() 变量转成整数类型
$line[1] = intval($line[1]);
$line[2] = intval($line[2]);
$line[3] = intval($line[3]);
转化成整数类型的变量重新组合数组$line
你也可以这样,重新赋值给变量
$line_a = intval($line[1]);
$line_b = intval($line[2]);
$line_c = intval($line[3]);
那么你的模板显示,对应的需要变动。

------解决方案--------------------
$line[1] = intval($line[1]); 
的作用是:确保最终的 $line[1] 的值是整数
何况原作者已经做了说明
38行有 keep only the number of items ordered
其它类似信息

推荐信息