Introduction
In this article I describe the PHP string functions quotemeta, rtrim and setlocal. To learn some other math functions, go to:
- String Functions in PHP: Part1
- String Functions in PHP:Part2
- String Functions in PHP:Part3
- String Functions in PHP:Part4
- String Functions in PHP:Part5
- String Functions in PHP:Part6
- String Functions in PHP:Part7
- String Functions in PHP:Part8
- String Functions in PHP:Part9
- String Functions in PHP:Part10
- String Functions in PHP:Part11
- String Functions in PHP:Part12
PHP quotemeta() Function
The PHP string quotemeta() function returns the string with meta characters quoted or say it adds backslashes in front of some predefined characters in a string.
Syntax
| quotemeta(string) |
Parameter in quotemeta Function
The parameters of the quotemeta function is:
| Parameter | Description |
| strings | It specifies the string to check. |
Example
An example of the quotemeta function is:
<?php
$str = "Mcn Solution. (PVT LTD)";
echo quotemeta($str);
?>
Output
PHP rtrim() Function
The PHP rtrim function will remove whitespace or other characters from the end of the string.
Syntax
| rtrim(string,charlist) |
Parameter in rtrim Function
The parameters of the rtrim function are:
| Parameter | Description |
| string | It specifies the string to check. |
| arg1 | It specifies which characters to remove from the string. |
Example
An example of the rtrim function is:
<?php
$str = "MCN Solution! ";
echo "Without rtrim: " . $str;
echo "<br />";
echo "With rtrim: " . rtrim($str);
?>
Output

View Source Code
PHP setlocal() Function
The PHP setlocal function is used to set local information.
Syntax
| setlocal(constant, location) |
Parameter in setlocal Function
The parameters of the setlocal function are:
| Parameter | Description |
| constant | It specifies what local information should be set. |
| location | It specifies what country or region to set the locale information to. Can be a string or an array. |
Example
An example of the setlocal function is:
<?php
echo setlocale(LC_ALL,NULL);
?>
Output

Join the conversation! Your thoughts help the community grow.