不管我比较的是两个数字或者字符串,明明不相同的两个竟然判断相等,这是怎么回事呢? if(10012014021504410429==10012014021504410429){ echo come; } 目测程序自动把字符串转为十进制数字了,php的int类型是32位的,多余的位数应该是被砍掉了,所以结果就是in
不管我比较的是两个数字或者字符串,明明不相同的两个竟然判断相等,这是怎么回事呢?
if("10012014021504410429"=="10012014021504410429"){
echo "come";}
目测程序自动把字符串转为十进制数字了,php的int类型是32位的,多余的位数应该是被砍掉了,所以结果就是int(2147483647) == int(2147483647),当然就是true了,用===阻止php自动类型转换,结果就是no了,弱类型语言,对比的时候能用===就要用===,==不可靠,隐含的规则太多太复杂,你不会想去记住的
if("10012014021504410429"=="10012014021504410429"){
echo "come";}

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SublimeText3 Chinese version
Chinese version, very easy to use

Atom editor mac version download
The most popular open source editor