1--TEST--
2casting different variables to array using settype()
3--FILE--
4<?php
5
6$r = fopen(__FILE__, "r");
7
8class test {
9    private $var1 = 1;
10    public $var2 = 2;
11    protected $var3 = 3;
12
13    function  __toString() {
14        return "10";
15    }
16}
17
18$o = new test;
19
20$vars = array(
21    "string",
22    "",
23    "\0",
24    "8754456",
25    9876545,
26    0.10,
27    array(),
28    array(1,2,3),
29    false,
30    true,
31    NULL,
32    $r,
33    $o
34);
35
36foreach ($vars as $var) {
37    settype($var, "array");
38    var_dump($var);
39}
40
41echo "Done\n";
42?>
43--EXPECTF--
44array(1) {
45  [0]=>
46  string(6) "string"
47}
48array(1) {
49  [0]=>
50  string(0) ""
51}
52array(1) {
53  [0]=>
54  string(1) "%0"
55}
56array(1) {
57  [0]=>
58  string(7) "8754456"
59}
60array(1) {
61  [0]=>
62  int(9876545)
63}
64array(1) {
65  [0]=>
66  float(0.1)
67}
68array(0) {
69}
70array(3) {
71  [0]=>
72  int(1)
73  [1]=>
74  int(2)
75  [2]=>
76  int(3)
77}
78array(1) {
79  [0]=>
80  bool(false)
81}
82array(1) {
83  [0]=>
84  bool(true)
85}
86array(0) {
87}
88array(1) {
89  [0]=>
90  resource(%d) of type (stream)
91}
92array(3) {
93  ["%0test%0var1"]=>
94  int(1)
95  ["var2"]=>
96  int(2)
97  ["%0*%0var3"]=>
98  int(3)
99}
100Done
101