PHP addcslashes function

Syntax of addcslashes

string addcslashes(string string, string characters)

Returns escaped instances of characters in string by adding a backslash before them. You can specify ranges of characters by separating them with two periods; for example, to escape characters between a and q, use “a..q”. Multiple characters and ranges can be specified in characters. The addcslashes() function is the inverse of stripcslashes()

Example of addcslashes function

<?php
$escaped = addcslashes($not_escaped, "\0..\37!@\177..\377");
?>

Leave a Comment