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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
29 - 22 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Mar 29 11:01:29 2024 UTC