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

PHP in_array函数的一个风险用法

WBOY
WBOYOriginal
2016-06-13 10:36:48726browse

PHP in_array函数的一个危险用法

<?phpif (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 '错误';

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

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