Home > Backend Development > PHP Tutorial > php基础 ||问题

php基础 ||问题

WBOY
Release: 2016-06-23 13:56:28
Original
1154 people have browsed it

<?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>";	}?>
Copy after login
打印结果:
1 01 01 1
Copy after login

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


回复讨论(解决方案)

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

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

Related labels:
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