summaryrefslogtreecommitdiff
path: root/tests/php/phpt/variables/005-cast-objects-to-scalars.phpt
blob: 9de9ba55fcfa2888bdadbcfaeafa04e8e3c9602c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 TestVariables\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