mirror of
https://github.com/php/php-src.git
synced 2024-12-02 22:34:55 +08:00
58 lines
784 B
PHP
58 lines
784 B
PHP
--TEST--
|
||
casting different variables to string
|
||
--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 = (string)$var;
|
||
var_dump($tmp);
|
||
}
|
||
|
||
echo "Done\n";
|
||
?>
|
||
--EXPECTF--
|
||
string(6) "string"
|
||
string(7) "8754456"
|
||
string(0) ""
|
||
string(1) " |