Home > Backend Development > PHP Tutorial > PHP in_array函数的一个风险用法

PHP in_array函数的一个风险用法

WBOY
Release: 2016-06-13 13:14:42
Original
865 people have browsed it

PHP in_array函数的一个危险用法

<?php
if (in_array('', array(0,1))) echo '错误';
if (in_array(false, array(0,1))) echo '错误';
if (in_array(true, array(0,1))) echo '错误';
if (in_array($a['a'], array(0,1))) echo '错误';
Copy after login

PHP in_array()函数中如果这样用的话就会出现问题,所以使用的时候要谨慎

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