diff options
Diffstat (limited to 'tests/php/phpt/variables/005-cast-objects-to-scalars.phpt')
-rw-r--r-- | tests/php/phpt/variables/005-cast-objects-to-scalars.phpt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt b/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt new file mode 100644 index 0000000..335acb7 --- /dev/null +++ b/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt @@ -0,0 +1,22 @@ +--TEST-- +cast objects to scalars +--DESCRIPTION-- +http://www.phpcpp.com/documentation/special-features#casting-functions +--SKIPIF-- +<?php if (!extension_loaded("extension_for_tests")) print "skip"; ?> +--FILEEOF-- +<?php + + +function bool2str($b) { + return $b ? "Yes" : "No"; +} +$obj = new Obj2Scalar(); +echo " long: ", (int)$obj, "\n string: ", (string)$obj, "\n double: ", (double)$obj, "\n bool: ", bool2str((bool)$obj); + + +--EXPECT-- + long: 27032014 + string: Mount Meru, also called Sumeru (Sanskrit) + double: 3.14159265359 + bool: Yes
\ No newline at end of file |