Home >headlines >php variable operation

php variable operation

无忌哥哥
无忌哥哥Original
2018-06-28 09:23:162447browse

Variable operations are divided according to the return value type:

1. Arithmetic operations: return numeric type (integet/float);

2. Logical operations: return Boolean type (true /false);

3. Character operation: Return string type (string);

Memory points: The return types are all scalars, four basic types.

var_dump(5+10);  //返回integer;
echo &#39;<hr>&#39;;
var_dump(3.14*5*5); //返回float;
echo &#39;<hr>&#39;;
var_dump(100>90); //返回布尔型bool的true
echo &#39;<hr>&#39;;
//&&:如果第一个表达式计算结果为false,整个结果就是false,后面就不会再计算了
var_dump(100>90 && 30 >= 50); //&#39;与&#39;返回false
echo &#39;<hr>&#39;;
//||:二个表达式都会被计算
var_dump(100>90 || 30 >= 50); //&#39;或&#39;返回false
echo &#39;<hr>&#39;;
$siteName = &#39;PHP中文网&#39;;
$course = &#39;php编程技术&#39;;
echo &#39;欢迎来到&#39;.$siteName.&#39;学习&#39;.$course; //字符串连接,返回一个新字符串
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:php variable scopeNext article:php variable scope