repo.or.cz
/
tomato.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Updates to Tomato RAF including NGINX && PHP
[tomato.git]
/
release
/
src
/
router
/
php
/
Zend
/
tests
/
settype_int.phpt
blob
7b96cd594eaa22156b2712429d069bef7fc44af1
1
--TEST--
2
casting different variables to integer using settype()
3
--FILE--
4
<?php
5
6
$r = fopen(__FILE__, "r");
7
8
class test {
9
function __toString() {
10
return "10";
11
}
12
}
13
14
$o = new test;
15
16
$vars = array(
17
"string",
18
"8754456",
19
"",
20
"\0",
21
9876545,
22
0.10,
23
array(),
24
array(1,2,3),
25
false,
26
true,
27
NULL,
28
$r,
29
$o
30
);
31
32
foreach ($vars as $var) {
33
settype($var, "int");
34
var_dump($var);
35
}
36
37
echo "Done\n";
38
?>
39
--EXPECTF--
40
int(0)
41
int(8754456)
42
int(0)
43
int(0)
44
int(9876545)
45
int(0)
46
int(0)
47
int(1)
48
int(0)
49
int(1)
50
int(0)
51
int(%d)
52
53
Notice: Object of class test could not be converted to int in %s on line %d
54
int(1)
55
Done