#45138 [Bgs]: What is this?

From: Date: Fri, 30 May 2008 14:28:32 +0000
Subject: #45138 [Bgs]: What is this?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125380@lists.php.net to get a copy of this message
ID: 45138 Updated by: felipe@php.net Reported By: bahadir at eggdrop dot gen dot tr Status: Bogus Bug Type: Filesystem function related Operating System: Windows XP PHP Version: 5.2.6 New Comment: Exactly, the last char is \n. "foo\n" != "foo". Again, use the flag FILE_IGNORE_NEW_LINES. Thanks. Previous Comments: ------------------------------------------------------------------------ [2008-05-30 14:23:08] bahadir at eggdrop dot gen dot tr var_dump($inthere); Result: array(4) { [0]=> string(8) "bahadir " [1]=> string(6) "baris " [2]=> string(6) "alper " [3]=> string(5) "halil" } ------------------------------------------------------------------------ [2008-05-30 13:55:54] felipe@php.net See the output: var_dump($inthere); The ignore the newlines use the second parameter (flags) with FILE_IGNORE_NEW_LINES. ------------------------------------------------------------------------ [2008-05-30 13:47:31] bahadir at eggdrop dot gen dot tr Description: ------------ in_array or file function doesn't work. Reproduce code: --------------- My test.php File: <?php $findme = 'bahadir'; $inthere = file('names.txt'); if (in_array($findme, $inthere)) { echo 'yes! :)'; } else { echo 'no :('; } ?> My names.txt File: bahadir baris alper halil Expected result: ---------------- Result: no :( Why? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45138&edit=1

« previous php.bugs (#125380) next »