ID:               45138
 Updated by:       [EMAIL PROTECTED]
 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] [EMAIL PROTECTED]

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

Reply via email to