xref: /PHP-8.1/Zend/tests/settype_null.phpt (revision f8d79582)
1--TEST--
2casting different variables to null using settype()
3--FILE--
4<?php
5
6$r = fopen(__FILE__, "r");
7
8class 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
32foreach ($vars as $var) {
33    settype($var, "null");
34    var_dump($var);
35}
36
37echo "Done\n";
38?>
39--EXPECT--
40NULL
41NULL
42NULL
43NULL
44NULL
45NULL
46NULL
47NULL
48NULL
49NULL
50NULL
51NULL
52NULL
53Done
54