summaryrefslogtreecommitdiff
path: root/Zend/tests/cast_to_bool.phpt
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-04-27 21:33:02 +0000
committerAntony Dovgal <tony2001@php.net>2007-04-27 21:33:02 +0000
commit70e6d3d042538cac68f17539bdc337244e92edee (patch)
treee3b70a6c9b373e46601d342be40dffd0febdcc4f /Zend/tests/cast_to_bool.phpt
parent9b1de77959c4d24ccb8e52ac166d22013d4aab4d (diff)
downloadphp-git-70e6d3d042538cac68f17539bdc337244e92edee.tar.gz
add new tests
Diffstat (limited to 'Zend/tests/cast_to_bool.phpt')
-rw-r--r--Zend/tests/cast_to_bool.phpt53
1 files changed, 53 insertions, 0 deletions
diff --git a/Zend/tests/cast_to_bool.phpt b/Zend/tests/cast_to_bool.phpt
new file mode 100644
index 0000000000..75ab09d1b5
--- /dev/null
+++ b/Zend/tests/cast_to_bool.phpt
@@ -0,0 +1,53 @@
+--TEST--
+casting different variables to boolean
+--FILE--
+<?php
+
+$r = fopen(__FILE__, "r");
+
+class test {
+ function __toString() {
+ return "10";
+ }
+}
+
+$o = new test;
+
+$vars = array(
+ "string",
+ "8754456",
+ "",
+ "\0",
+ 9876545,
+ 0.10,
+ array(),
+ array(1,2,3),
+ false,
+ true,
+ NULL,
+ $r,
+ $o
+);
+
+foreach ($vars as $var) {
+ $tmp = (bool)$var;
+ var_dump($tmp);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+Done