How to use trim in PHP
In this article I will explain how trim function can be used in PHP.
trim() Function
This function removes spaces and other predefined characters from both sides of a string.
Syntax
Example
<html>
<body>
<?php
$str = " Hello Swati! ";
echo "Without trim: " . $str;
echo "<br />";
echo "With trim: " . trim($str);
?>
</body>
</html> |
Output
You may also want to read these related articles Click here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here