summaryrefslogtreecommitdiff
path: root/Zend/tests/offset_array.phpt
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-06-01 11:57:49 +0000
committerAntony Dovgal <tony2001@php.net>2006-06-01 11:57:49 +0000
commitff59351416756edfdeb39b134a1b172059fca83c (patch)
treebc1bbe300361eb20cb466743669633859b3d74fd /Zend/tests/offset_array.phpt
parent29be5946f9b0b10f85ca28aa69c64a7bd275bed3 (diff)
downloadphp-git-ff59351416756edfdeb39b134a1b172059fca83c.tar.gz
add new tests
Diffstat (limited to 'Zend/tests/offset_array.phpt')
-rw-r--r--Zend/tests/offset_array.phpt47
1 files changed, 47 insertions, 0 deletions
diff --git a/Zend/tests/offset_array.phpt b/Zend/tests/offset_array.phpt
new file mode 100644
index 0000000000..a7e2f21b1c
--- /dev/null
+++ b/Zend/tests/offset_array.phpt
@@ -0,0 +1,47 @@
+--TEST--
+using different variables to access array offsets
+--FILE--
+<?php
+
+$arr = array(1,2,3,4,5,6,7,8);
+
+var_dump($arr[1]);
+var_dump($arr[0.0836]);
+var_dump($arr[NULL]);
+var_dump($arr["run away"]);
+
+var_dump($arr[TRUE]);
+var_dump($arr[FALSE]);
+
+$fp = fopen(__FILE__, "r");
+var_dump($arr[$fp]);
+
+$obj = new stdClass;
+var_dump($arr[$obj]);
+
+$arr1 = Array(1,2,3);
+var_dump($arr[$arr1]);
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(2)
+int(1)
+
+Notice: Undefined index: in %s on line %d
+NULL
+
+Notice: Undefined index: run away in %s on line %d
+NULL
+int(2)
+int(1)
+
+Strict Standards: Resource ID#%d used as offset, casting to integer (%d) in %s on line %d
+int(%d)
+
+Warning: Illegal offset type in %s on line %d
+NULL
+
+Warning: Illegal offset type in %s on line %d
+NULL
+Done