#73. PHP String Trim & Chop Functions

 How to work PHP String Trim & Chop Functions?

Syntax:


Run Code:

<?php

$str = "Hello World   ";
echo $str . "<br>";

// echo trim($str, "H");   // H, Hld,etc

// echo rtrim($str, "ld");

// echo ltrim($str, "Hld");

// for space
// echo trim($str);

echo chop ($str, "world");
?>

Comments

Popular posts from this blog

#30. PHP Recursive Function