|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-20 16:40 UTC] jani@php.net
[2007-07-20 21:39 UTC] jani@php.net
[2007-07-21 00:22 UTC] martin at martinmoen dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 15 22:00:01 2025 UTC |
Description: ------------ The trim function doesn't trim away whitespaces when giving it null value in the charlist. Reproduce code: --------------- function array_trim($arr, $charlist=null) { if (is_array($arr)) { foreach($arr as $key => $value) { if (is_array($value)) $result[$key] = array_trim($value, $charlist); else $result[$key] = trim($value, $charlist); } return $result; } } var_dump(array_trim(array(' foo', 'bar '))); Expected result: ---------------- array(2) { [0]=> string(3) "foo" [1]=> string(3) "bar" } Actual result: -------------- array(2) { [0]=> string(4) " foo" [1]=> string(4) "bar " }