- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
quotemeta() function in PHP
The quotemeta() function is used to quote meta-characters and add backslashes in front of the predefined characters. The following are some of the pre-defined characters: period (.), backslash (\), plus sign (+), asterisk (*), question mark (?), etc.
Syntax
quotemeta(str)
Parameters
str − The input string to check
Return
The quotemeta() function returns the string with meta-characters quoted. It returns FALSE if the input string is empty.
Example
The following is an example −
<?php $str = "3 * 9 = 27"; echo quotemeta($str); ?>
Output
3 \* 9 = 27
Example
The following is an example −
<?php $str = "The ticket cost for cricket match is 200$!"; echo quotemeta($str)."<br>"; ?>
Output
The ticket cost for cricket match is 200\$!
Advertisements