php中in_array函数用法分析,phpin_array
本文实例分析了php中in_array函数用法。分享给大家供大家参考。具体如下:
PHP是弱类型语言 在使用IN_ARRAY函数时尽量带上第三个参数,代码如下:
复制代码 代码如下:
var_dump(in_array(0,array('s','sss'),true)); // return false
var_dump(in_array(0,array('s','sss'))); // return true
var_dump(in_array(0,array(1,2,3))); // return false
从上面的三个函数可以看出来当,第一个:in_array(0,array('s','sss'),true),返回是我们想要的值.
使用:
复制代码 代码如下:
var_dump(in_array(0,array('s','sss')));
与:复制代码 代码如下:
var_dump(in_array(0,array(1,2,3)));
返回ture明显不是我们要的值了,因为主要是PHP为弱类型所以以前各位还是注意一些比较好了.
希望本文所述对大家的php程序设计有所帮助。

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

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

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools
