How To Remove Leading and Trailing Spaces from User Input Values in PHP?
Submitted by: AdministratorIf you are taking input values from users with a Web form, users may enter extra spaces at the beginning and/or the end of the input values. You should always use the trim() function to remove those extra spaces as shown in this PHP script:
<?php
$name = $_REQUEST("name");
$name = trim($name);
# $name is ready to be used...
?>
Submitted by: Administrator
<?php
$name = $_REQUEST("name");
$name = trim($name);
# $name is ready to be used...
?>
Submitted by: Administrator
Read Online PHP Job Interview Questions And Answers
Top PHP Questions
☺ | What is the difference between PHP4 and PHP5? |
☺ | What is the difference between characters \023 and \x23? |
☺ | What are the difference between abstract class and interface? |
☺ | How many ways we can pass the variable through the navigation between the pages? |
☺ | What Is the difference between htmlentities() and htmlspecialchars()? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |