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

1.1       misho       1: --TEST--
                      2: Test parse_str() function : basic functionality 
                      3: --FILE--
                      4: <?php
                      5:                
                      6: /* Prototype  : void parse_str  ( string $str  [, array &$arr  ] )
                      7:  * Description: Parses the string into variables
                      8:  * Source code: ext/standard/string.c
                      9: */
                     10: 
                     11: echo "*** Testing parse_str() : basic functionality ***\n";
                     12: 
                     13: echo "Basic test WITHOUT result arg\n";
                     14: $s1 = "first=val1&second=val2&third=val3";
                     15: var_dump(parse_str($s1));
                     16: var_dump($first, $second, $third);
                     17: 
                     18: echo "\nBasic test WITH undefined var for result arg\n";
                     19: $s1 = "first=val1&second=val2&third=val3";
                     20: var_dump(parse_str($s1, $res1));
                     21: var_dump($res1);
                     22: 
                     23: echo "\nBasic test WITH existing non-array var for result arg\n";
                     24: $res2 =99;
                     25: $s1 = "first=val1&second=val2&third=val3";
                     26: var_dump(parse_str($s1, $res2));
                     27: var_dump($res2);
                     28: 
                     29: echo "\nBasic test with an existing array as results array\n";
                     30: $res3_array = array(1,2,3,4);
                     31: var_dump(parse_str($s1, $res3_array));
                     32: var_dump($res3_array); 
                     33: 
                     34: ?>
                     35: ===DONE===
                     36: --EXPECTF--
                     37: *** Testing parse_str() : basic functionality ***
                     38: Basic test WITHOUT result arg
                     39: NULL
                     40: string(4) "val1"
                     41: string(4) "val2"
                     42: string(4) "val3"
                     43: 
                     44: Basic test WITH undefined var for result arg
                     45: NULL
                     46: array(3) {
                     47:   ["first"]=>
                     48:   string(4) "val1"
                     49:   ["second"]=>
                     50:   string(4) "val2"
                     51:   ["third"]=>
                     52:   string(4) "val3"
                     53: }
                     54: 
                     55: Basic test WITH existing non-array var for result arg
                     56: NULL
                     57: array(3) {
                     58:   ["first"]=>
                     59:   string(4) "val1"
                     60:   ["second"]=>
                     61:   string(4) "val2"
                     62:   ["third"]=>
                     63:   string(4) "val3"
                     64: }
                     65: 
                     66: Basic test with an existing array as results array
                     67: NULL
                     68: array(3) {
                     69:   ["first"]=>
                     70:   string(4) "val1"
                     71:   ["second"]=>
                     72:   string(4) "val2"
                     73:   ["third"]=>
                     74:   string(4) "val3"
                     75: }
                     76: ===DONE===

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