PHP数组中值的量化状态?

时间:2018-09-21 15:31:48

标签: php

我有这样的代码:

$a = array();
$i = 0;
$a['p'] = !isset($a['p']) ? 0 : $a['p'];
$b = ($i==0 && isset($a['p']) && $a['p'] == 'test') ? 'test' : $i+1;

$i = 1;
$a['p'] = !isset($a['p']) ? 0 : $a['p'];
$c = ($i==0 && isset($a['p']) && $a['p'] == 'test') ? 'test' : $i+1;

echo $a.' '.$b;

我在$ b中等待1,但实际上我在$ b中有一个“测试”,在$ c中有2 怎么可能?

PS。 PHP 5.4.16 @ CentOS 7

0 个答案:

没有答案