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
?>
(PHP 4, PHP 5, PHP 7, PHP 8)
stripcslashes — Decodifica un string codificado con addcslashes()
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.
string
El string a procesar.
Devuelve el string modificado.
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
?>
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
?>