php强制类型转换?

WBOY
Release: 2016-06-23 14:18:02
Original
1236 people have browsed it


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手册那个章节说明啊?

字符串转换为数值

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