chop() : remove string from right end
$string='Welcome to plus2net.com';
WE can remove white space at the end of the string .
Welcome to plus2net
echo chop("welcome to plus2net ");
To indentify the removal of white space we will add one more string and check like this.
welcome to plus2net
$str="Welcome to plus2net ";
The output is here
Welcome to plus2netThanks
In the above code we can check the difference by un-commenting 2nd line and adding the comment to third line. We will see the gap before the word Thanks
Welcome to plus2net Thanks
Other than white space we can also remove these .
"\0"-ASCII 0, null
"\r" carriage return
"\n" new line
"\x0B" vertical tab
" " white space
String Functionschunk_split(): Split a string into smaller chunks
Subscribe to our YouTube Channel here
This article is written by plus2net.com team.