How to remove white spaces from the beginning and/or the end of a string in php?



How to remove white spaces from the beginning and/or the end of a string in php?..

Answer / Bhoopal Singh

You can use the trim() function to remove white spaces from both the start and end of a string. Here is an example:nn```phpn$string = " hello ";n$clean_string = trim($string);n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

how to upload more than 50 mb? i tried but session was expired....certain time .....i was set session duration three days .... how to rectified? if any one know that post ur answer as soon as possible? thanks

1 Answers  


What is php built on?

1 Answers  


How can we encrypt the username and password using PHP?

13 Answers   Avaria, HCL, TCS, Xpert,


how do we can copy of the content of a web page with the help og the URL and display them onto any other page

5 Answers  


Is multiple inheritance supported in php?

1 Answers  


Suppose we receive a form submitted by a post to subscribe to a newsletter. This form has only one field, an input text field named email. How would we validate whether the field is empty? Print a message "the email cannot be empty" in this case?

1 Answers  


Are php variables global?

1 Answers  


What should we do to be able to export data into an excel file?

1 Answers  


What are the different filter functions used to filter a variable?

1 Answers  


Tell me what's the difference between include and require?

1 Answers  


How to find datatype of variable in php?

1 Answers  


What is $_ server request_method == post?

1 Answers  


Categories