php 运算符请问

WBOY
Release: 2016-06-13 13:40:06
Original
1074 people have browsed it

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>
Copy after login
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