1--TEST-- 2Test stripslashes() function : basic functionality 3--FILE-- 4<?php 5/* 6 * Testing stripslashes() with quoted strings 7*/ 8 9echo "*** Testing stripslashes() : basic functionality ***\n"; 10 11// Initialize all required variables 12$str_array = array( "How's everybody", // string containing single quote 13 'Are you "JOHN"?', // string with double quotes 14 'c:\php\stripslashes', // string with backslashes 15 'c:\\php\\stripslashes', // string with double backslashes 16 "hello\0world" // string with nul character 17 ); 18 19// Calling striplashes() with all arguments 20foreach( $str_array as $str ) { 21 $str_addslashes = addslashes($str); 22 var_dump("The string after addslashes is:", $str_addslashes); 23 $str_stripslashes = stripslashes($str_addslashes); 24 var_dump("The string after stripslashes is:", $str_stripslashes); 25 if( strcmp($str, $str_stripslashes) != 0 ) 26 echo "\nError: Original string and string after stripslashes donot match\n"; 27} 28 29echo "Done\n"; 30?> 31--EXPECTF-- 32*** Testing stripslashes() : basic functionality *** 33string(31) "The string after addslashes is:" 34string(16) "How\'s everybody" 35string(33) "The string after stripslashes is:" 36string(15) "How's everybody" 37string(31) "The string after addslashes is:" 38string(17) "Are you \"JOHN\"?" 39string(33) "The string after stripslashes is:" 40string(15) "Are you "JOHN"?" 41string(31) "The string after addslashes is:" 42string(21) "c:\\php\\stripslashes" 43string(33) "The string after stripslashes is:" 44string(19) "c:\php\stripslashes" 45string(31) "The string after addslashes is:" 46string(21) "c:\\php\\stripslashes" 47string(33) "The string after stripslashes is:" 48string(19) "c:\php\stripslashes" 49string(31) "The string after addslashes is:" 50string(12) "hello\0world" 51string(33) "The string after stripslashes is:" 52string(11) "hello%0world" 53Done 54