You are here: Home Programming PHP How to use PHP chop() Function?

How to use PHP chop() Function?

 

 

How to use PHP chop() Function

 

The chop() function will remove a white space or other predefined character from the right end of a string. Specifies which characters to remove from the string.
The following characters are allowed and is set to be removed if the charlist parameter is empty:

  • "\0" - ASCII 0, NULL
  • "\t" - ASCII 9, a tab
  • "\n" - ASCII 10, a new line
  • "\x0B" - ASCII 11, a vertical tab.
  • "\r" - ASCII 13, a carriage return
  • " " - ASCII 32, an ordinary white space

Syntax

chop(string,charlist)

 

Problem

<?php
$str = "Hello World!\n\n";
echo $str;
echo chop($str);
?> 

Solution

Hello World!  Hello World!


Clientele

 

SIGN UP RIGHT NOW FOR EMAIL UPDATES

Share this post


blog comments powered by Disqus

Print PDF

HTML Codes
opinions powered by SendLove.to

Our valuable member Khabza has been with us since Thursday, 08 July 2010.

Show Other Articles Of This Author

Back to top
SA Topsites :: Simphiwe - Find me on Bloggers.com

Copyright © Green IT Web - Blog by Khabza in Cape Town 2012

Template by Joomla 1.7 Templates & Szablony Joomla.