博客列表 >11.12 变量 运算符 逻辑运算符

11.12 变量 运算符 逻辑运算符

肖申克
肖申克原创
2019年11月14日 12:09:56628浏览

<?php
$bool = true;
$notBool='lol';
$int = 1;
$notInt='1';
$float = 1.23;
$notFloat = 'hi';
$str = 'i am a string';
$notStr= 2;
$null= null;

$ten = 10;
$two=2;
$three=3;

var_dump(is_bool($bool));
var_dump(is_bool($notBool));

var_dump(is_int($int));

var_dump(isset($null));
var_dump(empty($null));
echo "<hr>";
echo $ten+$two;
echo '<br>';
echo $ten-$two;
echo '<br>';
echo $ten*$two;
echo '<br>';
echo $ten/$two;
echo '<br>';
echo $ten%$three;
echo '<br>';
echo $ten++;
echo '<br>';
echo ++$ten;
echo '<br>';
echo $ten--;
echo '<br>';
echo --$ten;
echo '<br>';
echo $ten . $two;

echo "<hr>";

var_dump($ten>$two);
var_dump($ten>=$two);
var_dump($ten<$two);
var_dump($ten==$two);
var_dump($ten!=$two);
var_dump($ten===$ten);

echo "<hr>";
if ($ten>$two && $three>$two){
   echo 'this is true';
}
echo "<br>";
if ($ten>$two || $three<$two){
   echo 'this is true';
}

if (!false){
   echo '<br>'.'true';
}else {
   echo "<br>".'false';
}

?>

Screen Shot 2019-11-13 at 11.09.06 PM.png

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议