1--TEST--
2Test sscanf() function : basic functionality - octal format
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*/
10
11echo "*** Testing sscanf() : basic functionality - using octal format ***\n";
12
13$str = "0123 -0123 +0123 0129 -0129 +0129";
14$format = "%o %o %o %o %o %o";
15
16echo "\n-- Try sccanf() WITHOUT optional args --\n";
17// extract details using short format
18list($arg1, $arg2, $arg3, $arg4, $arg5, $arg6) = sscanf($str, $format);
19var_dump($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
20
21echo "\n-- Try sccanf() WITH optional args --\n";
22// extract details using long  format
23$res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
24var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
25
26?>
27===DONE===
28--EXPECT--
29*** Testing sscanf() : basic functionality - using octal format ***
30
31-- Try sccanf() WITHOUT optional args --
32int(83)
33int(-83)
34int(83)
35int(10)
36NULL
37NULL
38
39-- Try sccanf() WITH optional args --
40int(4)
41int(83)
42int(-83)
43int(83)
44int(10)
45NULL
46NULL
47===DONE===
48