2 /* Prototype : string stripslashes ( string $str )
3 * Description: Un-quotes a quoted string
4 * Source code: ext/standard/string.c
8 * Testing stripslashes() with quoted strings
11 echo "*** Testing stripslashes() : basic functionality ***\n";
13 // Initialize all required variables
14 $str_array = array( "How's everybody", // string containing single quote
15 'Are you "JOHN"?', // string with double quotes
16 'c:\php\stripslashes', // string with backslashes
17 'c:\\php\\stripslashes', // string with double backslashes
18 "hello\0world" // string with nul character
21 // Calling striplashes() with all arguments
22 foreach( $str_array as $str ) {
23 $str_addslashes = addslashes($str);
24 var_dump("The string after addslashes is:", $str_addslashes);
25 $str_stripslashes = stripslashes($str_addslashes);
26 var_dump("The string after stripslashes is:", $str_stripslashes);
27 if( strcmp($str, $str_stripslashes) != 0 )
28 echo "\nError: Original string and string after stripslashes donot match\n";