• PHP Video Tutorials

PHP - Function Trim



Syntax

trim(string,charlist)

Definition and Usage

It used to remove the whitespaces and other characters

Return Values

It returns the modified string

Parameters

Sr.No Parameters & Description
1

string

It is used to specifies string to check

2

charlist

It specifies which character to remove

Example

Try out the following example

<?php
   $input = "tutorials point";
   
   echo $input . "<br>";
   echo trim($input,"point");
?>

This will produce following result −

tutorials point
utorials
php_function_reference.htm
Advertisements