Annotation of embedaddon/php/ext/standard/tests/strings/sscanf_basic6.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test sscanf() function : basic functionality - unsigned format
                      3: --SKIPIF--
                      4: <?php
                      5: if (PHP_INT_SIZE != 4) {
                      6:        die("skip this test is for 32bit platform only");
                      7: }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: 
                     12: /* Prototype  : mixed sscanf  ( string $str  , string $format  [, mixed &$...  ] )
                     13:  * Description: Parses input from a string according to a format
                     14:  * Source code: ext/standard/string.c
                     15: */
                     16: 
                     17: echo "*** Testing sscanf() : basic functionality - using unsigned format ***\n";
                     18: 
                     19: $str = "-11 +11 11 -11.234 +11.234 11.234";
                     20: $format = "%u %u %u %u %u %u";
                     21: 
                     22: echo "\n-- Try sccanf() WITHOUT optional args --\n"; 
                     23: // extract details using short format
                     24: list($arg1, $arg2, $arg3, $arg4, $arg5, $arg6) = sscanf($str, $format);
                     25: var_dump($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
                     26: 
                     27: echo "\n-- Try sccanf() WITH optional args --\n"; 
                     28: // extract details using long  format
                     29: $res = sscanf($str, $format, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
                     30: var_dump($res, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6); 
                     31: 
                     32: ?>
                     33: ===DONE===
                     34: --EXPECT--
                     35: *** Testing sscanf() : basic functionality - using unsigned format ***
                     36: 
                     37: -- Try sccanf() WITHOUT optional args --
                     38: string(10) "4294967285"
                     39: int(11)
                     40: int(11)
                     41: string(10) "4294967285"
                     42: NULL
                     43: NULL
                     44: 
                     45: -- Try sccanf() WITH optional args --
                     46: int(4)
                     47: string(10) "4294967285"
                     48: int(11)
                     49: int(11)
                     50: string(10) "4294967285"
                     51: NULL
                     52: NULL
                     53: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>