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

From: Date: Mon, 21 Oct 2002 09:09:15 +0000
Subject: #20005 [Opn->Bgs]: trim does not trim a string in array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22946@lists.php.net to get a copy of this message
ID: 20005 Updated by: sander@php.net Reported By: chris@xwave.ch -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Linux suse 2.4.16-4GB PHP Version: 4.2.3 New Comment: for ($ic = 0 ; $ic > count($e); $ic++) { ^^^ That should be < of course. Previous Comments: ------------------------------------------------------------------------ [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 (#22946) next »