1--TEST--
2Test sscanf() function : error conditions
3--FILE--
4<?php
5
6/* Prototype  : mixed sscanf  ( string $str  , string $format  [, mixed &$...  ] )
7 * Description: Parses input from a string according to a format
8 * Source code: ext/standard/string.c
9*/
10echo "*** Testing sscanf() : error conditions ***\n";
11
12$str = "Hello World";
13$format = "%s %s";
14
15echo "\n-- Testing sscanf() function with no arguments --\n";
16var_dump( sscanf() );
17
18echo "\n-- Testing sscanf() function with one argument --\n";
19var_dump( sscanf($str) );
20
21echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n";
22
23var_dump( sscanf($str, $format, $str1, $str2, $extra_str) );
24
25?>
26===DONE===
27--EXPECTF--
28*** Testing sscanf() : error conditions ***
29
30-- Testing sscanf() function with no arguments --
31
32Warning: sscanf() expects at least 2 parameters, 0 given in %s on line %d
33NULL
34
35-- Testing sscanf() function with one argument --
36
37Warning: sscanf() expects at least 2 parameters, 1 given in %s on line %d
38NULL
39
40-- Testing sscanf() function with more than expected no. of arguments --
41
42Warning: sscanf(): Variable is not assigned by any conversion specifiers in %s on line %d
43int(-1)
44===DONE===
45