调用数组出现的一个奇怪的问题

WBOY
Release: 2016-06-23 13:15:17
Original
1036 people have browsed it

$_px = (int)$px-1; echo ">- $_px -echo $orderlist[54]['paperid']; echo "|||";

如果这里写  $orderlist[54]['paperid'];   就可以把值给打印出来

如果写$orderlist[$_px]['paperid']; 值就为0了,好像是没了

请问这个是为什么呀?

那应该怎么写呢?


回复讨论(解决方案)

echo $orderlist[54]['paperid'];值为1234

------
但是
$_px = 55;
$_px = $px-1;
echo $orderlist[$_px]['paperid'];值为0了

echo $orderlist[54]['paperid'];值为1234

------
但是
$_px = 55;
$_px = $_px-1;
echo $orderlist[$_px]['paperid'];值为0了 

$orderlist = array();$orderlist[54] = array(    'paperid' => 1234);echo $orderlist[54]['paperid'].'<br>';$_px = 55;$_px = $_px-1;echo $orderlist[$_px]['paperid'];
Copy after login


都是输出1234,没有问题。

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template