7.17.2006

Functionality of the PHP trim command I bet you did not know

trim

(PHP 3, PHP 4 , PHP 5)trim -- Strip whitespace from the beginning and end of a string

Description

string trim ( string str [, string charlist]) You can also specify the characters you want to strip, by means of the charlist parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters. Example:

$strComma = "item 1, item 2, item 3,"; 
echo trim($strComma, ',');

No comments:

Post a Comment