1--TEST--
2Test addslashes() function : basic functionality
3--FILE--
4<?php
5/*
6 * Testing addslashes() with strings containing characters that can be prefixed with backslash
7 * by the function
8*/
9
10echo "*** Testing addslashes() : basic functionality ***\n";
11
12// Initialize all required variables
13$str_array = array( "How's everybody",   // string containing single quote
14                    'Are you "JOHN"?',   // string with double quotes
15                    'c:\php\addslashes',   // string with backslashes
16                    "hello\0world"   // string with nul character
17                  );
18
19// Calling addslashes() with all arguments
20foreach( $str_array as $str )  {
21  var_dump( addslashes($str) );
22}
23
24echo "Done\n";
25?>
26--EXPECT--
27*** Testing addslashes() : basic functionality ***
28string(16) "How\'s everybody"
29string(17) "Are you \"JOHN\"?"
30string(19) "c:\\php\\addslashes"
31string(12) "hello\0world"
32Done
33