1--TEST--
2Test sscanf() function : basic functionality - exponential format
3--FILE--
4<?php
5
6echo "*** Testing sscanf() : basic functionality -using exponential format ***\n";
7
8$str = "10.12345 10.12345E3 10.12345e3 -10.12345e4" ;
9$format1 = "%e %e %e %e";
10$format2 = "%E %E %E %E";
11
12echo "\n-- Try sccanf() WITHOUT optional args --\n";
13// extract details using short format
14list($arg1, $arg2, $arg3, $arg4) = sscanf($str, $format1);
15var_dump($arg1, $arg2, $arg3, $arg4);
16list($arg1, $arg2, $arg3, $arg4) = sscanf($str, $format2);
17var_dump($arg1, $arg2, $arg3, $arg4);
18
19echo "\n-- Try sccanf() WITH optional args --\n";
20// extract details using long  format
21$res = sscanf($str, $format1, $arg1, $arg2, $arg3, $arg4);
22var_dump($res, $arg1, $arg2, $arg3, $arg4);
23$res = sscanf($str, $format2,$arg1, $arg2, $arg3, $arg4);
24var_dump($res, $arg1, $arg2, $arg3, $arg4);
25
26
27?>
28--EXPECT--
29*** Testing sscanf() : basic functionality -using exponential format ***
30
31-- Try sccanf() WITHOUT optional args --
32float(10.12345)
33float(10123.45)
34float(10123.45)
35float(-101234.5)
36float(10.12345)
37float(10123.45)
38float(10123.45)
39float(-101234.5)
40
41-- Try sccanf() WITH optional args --
42int(4)
43float(10.12345)
44float(10123.45)
45float(10123.45)
46float(-101234.5)
47int(4)
48float(10.12345)
49float(10123.45)
50float(10123.45)
51float(-101234.5)
52