Annotation of embedaddon/php/ext/standard/tests/array/array_push_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_push() function : basic functionality
3: --FILE--
4: <?php
5: /* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
6: * Description: Pushes elements onto the end of the array
7: * Source code: ext/standard/array.c
8: */
9:
10: /*
11: * Test basic functionality of array_push with indexed and associative arrays
12: */
13:
14: echo "*** Testing array_push() : basic functionality ***\n";
15:
16: $array = array ('zero', 'one', 'two');
17: $var1 = 'three';
18: $var2 = 'four';
19:
20: echo "\n-- Push values onto an indexed array --\n";
21: var_dump(array_push($array, $var1, $var2));
22: var_dump($array);
23:
24: $array_assoc = array ('one' => 'un', 'two' => 'deux');
25:
26: echo "\n-- Push values onto an associative array --\n";
27: var_dump(array_push($array_assoc, $var1, $var2));
28: var_dump($array_assoc);
29:
30: echo "Done";
31: ?>
32:
33: --EXPECTF--
34: *** Testing array_push() : basic functionality ***
35:
36: -- Push values onto an indexed array --
37: int(5)
38: array(5) {
39: [0]=>
40: string(4) "zero"
41: [1]=>
42: string(3) "one"
43: [2]=>
44: string(3) "two"
45: [3]=>
46: string(5) "three"
47: [4]=>
48: string(4) "four"
49: }
50:
51: -- Push values onto an associative array --
52: int(4)
53: array(4) {
54: ["one"]=>
55: string(2) "un"
56: ["two"]=>
57: string(4) "deux"
58: [0]=>
59: string(5) "three"
60: [1]=>
61: string(4) "four"
62: }
63: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>