summaryrefslogtreecommitdiff
path: root/Zend/tests/offset_string.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_string.phpt
parent29be5946f9b0b10f85ca28aa69c64a7bd275bed3 (diff)
downloadphp-git-ff59351416756edfdeb39b134a1b172059fca83c.tar.gz
add new tests
Diffstat (limited to 'Zend/tests/offset_string.phpt')
-rw-r--r--Zend/tests/offset_string.phpt45
1 files changed, 45 insertions, 0 deletions
diff --git a/Zend/tests/offset_string.phpt b/Zend/tests/offset_string.phpt
new file mode 100644
index 0000000000..63d8abe8dd
--- /dev/null
+++ b/Zend/tests/offset_string.phpt
@@ -0,0 +1,45 @@
+--TEST--
+using different variables to access string offsets
+--FILE--
+<?php
+
+$str = "Sitting on a corner all alone, staring from the bottom of his soul";
+
+var_dump($str[1]);
+var_dump($str[0.0836]);
+var_dump($str[NULL]);
+var_dump($str["run away"]);
+
+var_dump($str[TRUE]);
+var_dump($str[FALSE]);
+
+$fp = fopen(__FILE__, "r");
+var_dump($str[$fp]);
+
+$obj = new stdClass;
+var_dump($str[$obj]);
+
+$arr = Array(1,2,3);
+var_dump($str[$arr]);
+
+echo "Done\n";
+?>
+--EXPECTF--
+string(1) "i"
+string(1) "S"
+string(1) "S"
+string(1) "S"
+string(1) "i"
+string(1) "S"
+
+Warning: Illegal offset type in %s on line %d
+string(1) "%s"
+
+Warning: Illegal offset type in %s on line %d
+
+Notice: Object of class stdClass could not be converted to int in %s on line %d
+string(1) "%s"
+
+Warning: Illegal offset type in %s on line %d
+string(1) "i"
+Done