diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
|---|---|---|
| committer | <> | 2013-04-03 16:25:08 +0000 |
| commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
| tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/spl/tests/array_001.phpt | |
| download | php2-master.tar.gz | |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/spl/tests/array_001.phpt')
| -rw-r--r-- | ext/spl/tests/array_001.phpt | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/ext/spl/tests/array_001.phpt b/ext/spl/tests/array_001.phpt new file mode 100644 index 0000000..b55fcba --- /dev/null +++ b/ext/spl/tests/array_001.phpt @@ -0,0 +1,113 @@ +--TEST-- +SPL: ArrayObject +--FILE-- +<?php + +$ar = array(0=>0, 1=>1); +$ar = new ArrayObject($ar); + +var_dump($ar); + +$ar[2] = 2; +var_dump($ar[2]); +var_dump($ar["3"] = 3); + +var_dump(array_merge((array)$ar, array(4=>4, 5=>5))); + +var_dump($ar["a"] = "a"); + +var_dump($ar); +var_dump($ar[0]); +var_dump($ar[6]); +var_dump($ar["b"]); + +unset($ar[1]); +unset($ar["3"]); +unset($ar["a"]); +unset($ar[7]); +unset($ar["c"]); +var_dump($ar); + +$ar[] = '3'; +$ar[] = 4; +var_dump($ar); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(2) { + [0]=> + int(0) + [1]=> + int(1) + } +} +int(2) +int(3) +array(6) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + [4]=> + int(4) + [5]=> + int(5) +} +string(1) "a" +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(5) { + [0]=> + int(0) + [1]=> + int(1) + [2]=> + int(2) + [3]=> + int(3) + ["a"]=> + string(1) "a" + } +} +int(0) + +Notice: Undefined offset: 6 in %sarray_001.php on line %d +NULL + +Notice: Undefined index: b in %sarray_001.php on line %d +NULL + +Notice: Undefined offset: 7 in %sarray_001.php on line %d + +Notice: Undefined index: c in %sarray_001.php on line %d +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(2) { + [0]=> + int(0) + [2]=> + int(2) + } +} +object(ArrayObject)#%d (1) { + ["storage":"ArrayObject":private]=> + array(4) { + [0]=> + int(0) + [2]=> + int(2) + [4]=> + string(1) "3" + [5]=> + int(4) + } +} +===DONE=== |
