chop() function returns a string minus any ending whitespace and newlines. : chop « String « PHP






chop() function returns a string minus any ending whitespace and newlines.

 
Its syntax is: string chop (string str)

//Using chop() to remove unnecessary newlines:

<?
    $header = "Table of Contents:\n\n";
    $header = chop($header);
    print $header;
?>
  
  








Related examples in the same category