note 87460 added to function.trim
| From: | mcblack at osu1 dot php dot net | Date: | Fri, 05 Dec 2008 22:44:40 +0000 |
| Subject: | note 87460 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-147729@lists.php.net to get a copy of this message | ||
@Brizz
you can easily create a function to trim arrays... this works fine for me.
<?php
function trim_array( $array, $charset = 0 ) {
foreach ( $array as $str ) {
if( $charset !== 0 ) {
$out[] = trim( $str, $charset );
} else {
$out[] = trim( $str );
}
}
return $out;
}
$array = array( "foo\n\n", "\nfoo\n", "\tfoo" );
$trimmed = trim_array( $array );
print_r( $trimmed );
print "\n";
$array = array( "0bar0", "#bar#", "~bar~" );
$trimmed = trim_array( $array, "0#~" );
print_r( $trimmed );
?>
----
Server IP: 64.71.164.2
Probable Submitter: 67.86.12.113
----
Manual Page -- http://www.php.net/manual/en/function.trim.php
Edit -- https://master.php.net/note/edit/87460
Del: integrated -- https://master.php.net/note/delete/87460/integrated
Del: useless -- https://master.php.net/note/delete/87460/useless
Del: bad code -- https://master.php.net/note/delete/87460/bad+code
Del: spam -- https://master.php.net/note/delete/87460/spam
Del: non-english -- https://master.php.net/note/delete/87460/non-english
Del: in docs -- https://master.php.net/note/delete/87460/in+docs
Del: other reasons-- https://master.php.net/note/delete/87460
Reject -- https://master.php.net/note/reject/87460
Search -- https://master.php.net/manage/user-notes.php