php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #18003 trim() to accept arrays as argument
Submitted: 2002-06-26 18:10 UTC Modified: 2003-02-06 14:33 UTC
From: carlos at wfmgh dot org dot pl Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.2.1 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: carlos at wfmgh dot org dot pl
New email:
PHP Version: OS:

 

 [2002-06-26 18:10 UTC] carlos at wfmgh dot org dot pl
+1 from me to make trim() understanding array as 1st argument and in that case trim all elements in array each by each.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-10 18:18 UTC] maxim@php.net
Trim is a stricly string function, I don't see any need giving it an array as argument...

It is so easy to do with php by applying array_walk() to your array or simply looping it... If your case really needs it tyou hen can just add it into sources yourself.

On the other hand, there are already string functions that accept arrays in place of strings returning elaborated lements...

Anyone? Leave this request or close it?
 [2002-11-10 18:29 UTC] moriyoshi@php.net
Hmm, -1 for having this feature. In simplest case, you can also use array_map() for this purpose:

$result = array_map('trim',$array);

I don't think this code is too tedious.
 [2003-02-06 14:33 UTC] iliaa@php.net
Both array_map and array_walk can be used to implement this quite easily. I see no reason to make a string function support array arguments.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 07:01:30 2024 UTC