Home > Backend Development > PHP Tutorial > 问一个Js的语法,在PHP该怎样表示?解决方法

问一个Js的语法,在PHP该怎样表示?解决方法

WBOY
Release: 2016-06-13 13:42:20
Original
711 people have browsed it

问一个Js的语法,在PHP该怎样表示?
Javascript:

JScript code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
var a = 'a';
var b = null;
alert(a||b);
//这会输出a的变量值,,想问一下php应该怎么表示?

Copy after login

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
$a = 'A';
$b = null;
echo $a || $b;
//这样只会输出1或0,,
//我以前记得在哪个Oauth的开发文档上看过...但我现在忘记了...
//不知道有能人能告诉一下本人..Thanks

Copy after login


------解决方案--------------------
$a = 'A';
$b = null;
$c = $a or $c = $b;
echo $c;
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