summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/stripcslashes_basic.phpt
blob: 493e66913173cd2df7fc73e41e6f78826a3b16dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--TEST--
Test stripcslashes() function : basic functionality
--FILE--
<?php

/* Prototype  : string stripcslashes  ( string $str  )
 * Description: Returns a string with backslashes stripped off. Recognizes C-like \n, \r ...,
 *              octal and hexadecimal representation.
 * Source code: ext/standard/string.c
*/

echo "*** Testing stripcslashes() : basic functionality ***\n";
var_dump(stripcslashes('\H\e\l\l\o \W\or\l\d'));
var_dump(stripcslashes('Hello World\\r\\n'));
var_dump(stripcslashes('\\\Hello World'));
var_dump(stripcslashes('\x48\x65\x6c\x6c\x6f \x57\x6f\x72\x6c\x64'));
var_dump(stripcslashes('\110\145\154\154\157 \127\157\162\154\144'));

var_dump(bin2hex(stripcslashes('\\a')));
var_dump(bin2hex(stripcslashes('\\b')));
var_dump(bin2hex(stripcslashes('\\f')));
var_dump(bin2hex(stripcslashes('\\t')));
var_dump(bin2hex(stripcslashes('\\v')));
?>
===DONE===
--EXPECT--
*** Testing stripcslashes() : basic functionality ***
string(11) "Hello World"
string(13) "Hello World
"
string(12) "\Hello World"
string(11) "Hello World"
string(11) "Hello World"
string(2) "07"
string(2) "08"
string(2) "0c"
string(2) "09"
string(2) "0b"
===DONE===