To disapearing a white space of words we coud use trim() function
trim() will be delete white space from the beginning and end of a string
$text = "\t\tThese are a few words :) ... ";
echo trim($text); // "These are a few words :) ..."
echo trim($text, " \t."); // "These are a few words :)"
// trim the ASCII control characters at the beginning and end of $binary
// (from 0 to 31 inclusive)
$clean = trim($binary, "\x00..\x1F");
?>
ltrim() Strip whitespace (or other characters) from the beginning of a string
$text = "\t\tThese are a few words :) ... ";
$trimmed = ltrim($text);
// $trimmed = "These are a few words :) ... "
$trimmed = ltrim($text, " \t.");
// $trimmed = "These are a few words :) ... "
$clean = ltrim($binary, "\x00..\x1F");
// trim the ASCII control characters at the beginning of $binary
// (from 0 to 31 inclusive)
?>
Strip whitespace (or other characters) from the end of a string
$text = "\t\tThese are a few words :) ... ";
$trimmed = rtrim($text);
// $trimmed = "\t\tThese are a few words :) ..."
$trimmed = rtrim($text, " \t.");
// $trimmed = "\t\tThese are a few words :)"
$clean = rtrim($binary, "\x00..\x1F");
// trim the ASCII control characters at the end of $binary
// (from 0 to 31 inclusive)
?>
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar