mirror of
https://github.com/php/php-src.git
synced 2024-10-22 08:47:29 +00:00
86 lines
1.5 KiB
Plaintext
86 lines
1.5 KiB
Plaintext
|
--TEST--
|
|||
|
Test addcslashes() function (variation 1)
|
|||
|
--INI--
|
|||
|
precision=14
|
|||
|
--FILE--
|
|||
|
<?php
|
|||
|
|
|||
|
echo "*** Testing addcslashes() for basic operations ***\n";
|
|||
|
/* checking normal operation of addcslashes */
|
|||
|
$string = "goodyear12345NULL\0truefalse\a\v\f\b\n\r\t";
|
|||
|
$charlist = array (
|
|||
|
NULL,
|
|||
|
2,
|
|||
|
array(5,6,7),
|
|||
|
"a",
|
|||
|
"\0",
|
|||
|
"\n",
|
|||
|
"\r",
|
|||
|
"\t",
|
|||
|
"\a",
|
|||
|
"\v",
|
|||
|
"\b",
|
|||
|
"\f"
|
|||
|
);
|
|||
|
/* loop prints string with backslashes before characters
|
|||
|
mentioned in $char using addcslashes() */
|
|||
|
$counter = 1;
|
|||
|
foreach($charlist as $char) {
|
|||
|
echo "-- Iteration $counter --\n";
|
|||
|
var_dump( addcslashes($string, $char) );
|
|||
|
$counter++;
|
|||
|
}
|
|||
|
|
|||
|
echo "Done\n";
|
|||
|
|
|||
|
?>
|
|||
|
--EXPECTF--
|
|||
|
*** Testing addcslashes() for basic operations ***
|
|||
|
-- Iteration 1 --
|
|||
|
string(36) "goodyear12345NULL |