stripslashes

Un-quotes a quoted string

Syntax

stripslashes ( string $str ) : string

Parameters

str

The input string.

Return

Returns a string with backslashes stripped off. A backslash with a single quote (\') becomes a single quote ('). A double backslash (\\) becomes a single backslash (\). And so on.

Examples

1 · str

<?

$str = "twelve o\'clock";

$return = stripslashes($str);

echo $return;

?>
twelve o'clock

2 · Recursive

<?

function stripslashesrecursive($value) {
    if (is_array($value)) {
        $value = array_map('stripslashesrecursive', $value);
    } else {
        $value = stripslashes($value);
    }
    return $value;
}

$array = array("one o\'clock", "two o\'clock", array("three o\'clock", "four o\'clock"));

$return = stripslashesrecursive($array);

print_r($return);

?>
Array
(
    [0] => one o'clock
    [1] => two o'clock
    [2] => Array
        (
            [0] => three o'clock
            [1] => four o'clock
        )

)

addcslashes

addslashes

bin2hex

chop

chr

chunk_split

convert_uudecode

convert_uuencode

count_chars

crc32

crypt

echo

explode

fprintf

get_html_translation_table

hebrev

hebrevc

hex2bin

html_entity_decode

htmlentities

htmlspecialchars

htmlspecialchars_decode

implode

join

lcfirst

levenshtein

localeconv

ltrim

md5

md5_file

metaphone

nl_langinfo

nl2br

number_format

ord

parse_str

print

printf

quoted_printable_decode

quoted_printable_encode

quotemeta

rtrim

setlocale

sha1

sha1_file

similar_text

soundex

sprintf

sscanf

str_contains

str_ends_with

str_getcsv

str_ireplace

str_pad

str_repeat

str_replace

str_rot13

str_shuffle

str_split

str_starts_with

str_word_count

strcasecmp

strchr

strcmp

strcoll

strcspn

strip_tags

stripcslashes

stripos

stristr

strlen

strnatcasecmp

strnatcmp

strncasecmp

strncmp

strpbrk

strpos

strrchr

strrev

strripos

strrpos

strspn

strstr

strtok

strtolower

strtoupper

strtr

substr

substr_compare

substr_count

substr_replace

trim

ucfirst

ucwords

vfprintf

vprintf

vsprintf

wordwrap

PHP

Home Menu