• PHP Video Tutorials

PHP - Function preg_quote()


Advertisements

Syntax

string preg_quote ( string $str [, string $delimiter] );

Definition and Usage

preg_quote() takes str and puts a backslash in front of every character that is part of the regular expression syntax.

Return Value

  • Returns the quoted string.

Example

Following is the piece of code, copy and paste this code into a file and verify the result.

<?php
   $keywords = '$40 for a g3/400';
   $keywords = preg_quote($keywords, '/');
   
   echo $keywords;
?>

This will produce the following result −

\$40 for a g3\/400
php_regular_expression.htm

Useful Video Courses


Video

PHP Online Training

45 Lectures 9 hours

Malhar Lathkar

Video

Become PHP Facebook Developer: Password-Less Authentication

34 Lectures 4 hours

Syed Raza

Video

Ultimate PHP & MySQL Web Development Course & OOP Coding

84 Lectures 5.5 hours

Frahaan Hussain

Video

Learn PHP from Scratch

17 Lectures 1 hours

Nivedita Jain

Video

E Commerce Website Development In PHP With PDO

100 Lectures 34 hours

Azaz Patel

Video

PHP in Telugu

43 Lectures 5.5 hours

Vijay Kumar Parvatha Reddy

Advertisements