PHP 8.5.0 Alpha 2 available for testing

stripcslashes

(PHP 4, PHP 5, PHP 7, PHP 8)

stripcslashesDecodifica un string codificado con addcslashes()

Descripción

stripcslashes(string $string): string

Devuelve el string str después de eliminar todas las barras invertidas. stripcslashes() respeta las secuencias especiales de C, tales como \n, \r..., los números octales y hexadecimales.

Parámetros

string

El string a procesar.

Valores devueltos

Devuelve el string modificado.

Ejemplos

Ejemplo #1 Ejemplo con stripcslashes()

<?php

var_dump
(stripcslashes('I\'d have a coffee.\nNot a problem.') === "I'd have a coffee.
Not a problem."
); // true
?>

Ver también

  • addcslashes() - Añade barras invertidas a un string, al estilo del lenguaje C

add a note

User Contributed Notes 1 note

up
14
rafayhingoro[at]hotmail[dot]com
8 years ago
stripcslashes does not simply skip the C-style escape sequences \a, \b, \f, \n, \r, \t and \v, but converts them to their actual meaning.

So
<?php
stripcslashes
('\n') == "\n"; //true;

$str = "we are escaping \r\n"; //we are escaping

?>
To Top