#20005 [Bgs]: trim does not trim a string in array

From: Date: Mon, 21 Oct 2002 09:12:24 +0000
Subject: #20005 [Bgs]: trim does not trim a string in array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22947@lists.php.net to get a copy of this message
ID: 20005 User updated by: chris@xwave.ch Reported By: chris@xwave.ch Status: Bogus Bug Type: Strings related Operating System: Linux suse 2.4.16-4GB PHP Version: 4.2.3 New Comment: Stupid myself. thx... Chris Previous Comments: ------------------------------------------------------------------------ [2002-10-21 04:09:14] sander@php.net for ($ic = 0 ; $ic > count($e); $ic++) { ^^^ That should be < of course. ------------------------------------------------------------------------ [2002-10-21 04:04:36] chris@xwave.ch I've got this code segement: --- snip --- $buffer = fgets($if); $e = split("\t", trim($buffer)); for ($ic = 0 ; $ic > count($e); $ic++) { $e[$ic] = trim($e[$ic]); } --- snap --- The string in the array $e[] is never trimmed. In it does just the same as $e[$ic] = $e[$ic]; Same behaviour in chop! When I changed the code to this: --- snip --- $buffer = fgets($if); $b = trim($buffer); $e = split("\t", $b); for ($ic = 0 ; $ic < count($e); $ic++) { $t[$ic] = trim($e[$ic]); } --- snap --- it works as expected. Chris ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20005&edit=1

« previous php.bugs (#22947) next »