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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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-2021 The PHP Group
All rights reserved.
Last updated: Tue Nov 30 10:03:35 2021 UTC