Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / standard / tests / strings / sscanf_basic3.phpt
blobde910ef4b8cc0b2707c898b2612d6815bbb865ec
1 --TEST--
2 Test sscanf() function : basic functionality - float format
3 --FILE--
4 <?php
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 */
11 echo "*** Testing sscanf() : basic functionality -- using float format ***\n";
13 $str = "Part: Widget Length: 111.53 Width: 22.345 Depth: 12.4";
14 $format = "Part: %s Length: %f Width: %f Depth: %f";
16 echo "\n-- Try sccanf() WITHOUT optional args --\n"; 
17 // extract details using short format
18 list($part, $length, $width, $depth) = sscanf($str, $format);
19 var_dump($part, $length, $width, $depth);
21 echo "\n-- Try sccanf() WITH optional args --\n"; 
22 // extract details using long  format
23 $res = sscanf($str, $format, $part, $length, $width, $depth);
24 var_dump($res, $part, $length, $width, $depth); 
27 ===DONE===
28 --EXPECT--
29 *** Testing sscanf() : basic functionality -- using float format ***
31 -- Try sccanf() WITHOUT optional args --
32 string(6) "Widget"
33 float(111.53)
34 float(22.345)
35 float(12.4)
37 -- Try sccanf() WITH optional args --
38 int(4)
39 string(6) "Widget"
40 float(111.53)
41 float(22.345)
42 float(12.4)
43 ===DONE===