Bug #67927 [Nab]: in_array returns false searching for the word 'array'

From: Date: Thu, 28 Aug 2014 21:04:17 +0000
Subject: Bug #67927 [Nab]: in_array returns false searching for the word 'array'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187328@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67927&edit=1 ID: 67927 User updated by: jhackwell at docmagic dot com Reported by: jhackwell at docmagic dot com Summary: in_array returns false searching for the word 'array' Status: Not a bug Type: Bug Package: Arrays related Operating System: Centos 6.5 PHP Version: 5.6.0 Block user comment: N Private report: N New Comment: Good catch. The word had been copy-pasted from elsewhere, so I didn't notice. Thanks. Previous Comments: ------------------------------------------------------------------------ [2014-08-28 21:00:56] aharvey@php.net You have a non-breaking space at the start of the 'array' in your $arr definition, hence the in_array() fails. ------------------------------------------------------------------------ [2014-08-28 20:59:12] jhackwell at docmagic dot com Description: ------------ The in_array function does not seem to be able to find the word 'array' inside an array. Test script: --------------- $arr = array( '​array', ); echo in_array('array', $arr) ? 'it\'s there' : 'it\'s not there'; Expected result: ---------------- it's there Actual result: -------------- it's not there ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67927&edit=1

« previous php.bugs (#187328) next »