Home  >  Article  >  Backend Development  >  php 运算符请问

php 运算符请问

WBOY
WBOYOriginal
2016-06-13 10:12:25800browse

php 运算符请教
$a = "24 five 6" + 6;
echo $a."
";
输出为什么是30啊?
新手多多指教

------解决方案--------------------

探讨

字符串 转为整数就是24吗?为什么呢?

------解决方案--------------------
PHP code
<?php $foo = "0";  // $foo 是字符串 (ASCII 48)$foo += 2;   // $foo 现在是一个整数 (2)$foo = $foo + 1.3;  // $foo 现在是一个浮点数 (3.3)$foo = 5 + "10 Little Piggies"; // $foo 是整数 (15)$foo = 5 + "10 Small Pigs";     // $foo 是整数 (15)?><div class="clear">
                 
              
              
        
            </div>
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