PHP Programing language

chop() Functions in PHP
Previous Home Next

chop()

The chop() function removes whitespaces or other predefined characters from the right end of a string.

Syntax:
chop(string,charlist)

In above syntax, "string" specifies the string to check and "charlist" specifies which characters to remove from the string is as follows:

  • "\0" - NULL
  • "\t" - tab
  • "\n" - new line
  • "\x0B" - vertical tab
  • "\r" - carriage return
  • " " - ordinary white space

 

Example:

chop(string,charlist)<?php
$str = "Gud Morning!\n\n";
echo $str;
echo chop($str);
?>

Output:

Gud Morning! Gud Morning!

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: