Home  >  Article  >  Backend Development  >  php基础 ||问题

php基础 ||问题

WBOY
WBOYOriginal
2016-06-23 13:56:281090browse

<?php	$a=0;	$b=0;	if($a=3 || $b=3)        //相当于 if($a = (3 || $b=3)),true的结果是1,false的结果是0;	{		echo $a." ".$b."<br>";		$a++;		echo $a." ".$b."<br>";		$b++;		echo $a." ".$b."<br>";	}?>
打印结果:
1 01 01 1

请问第9行的$a++没有执行,这是为什么呢?


回复讨论(解决方案)

if($a= intval(3 || $b=3))
布尔值应该不能++ -- 的吧

哦,对啊,布尔值++后的结果好像不变啊;
看样子我是受了Java的影响了;

Statement:
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
Previous article:端口转向的问题Next article:php做什么项目