Home  >  Article  >  Backend Development  >  php强制类型转换?

php强制类型转换?

WBOY
WBOYOriginal
2016-06-23 14:18:021196browse


1.字符串强制转整型,为什么结果是:0?
2.任何类型,都可以转换成数组?
3.任何类型,都可以转换成对象?


回复讨论(解决方案)

1、字符串转换成数值时,制转换左边的数值串部分
2、3、 是的

1、字符串转换成数值时,制转换左边的数值串部分
2、3、 是的

不明白!

echo (int)'abcd'; //0
echo (int)'3abcd'; //3
echo (int)'-5abcd'; //-5

你应该看看php 手册

你应该看看php 手册

php手册那个章节说明啊?

字符串转换为数值

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