Re: Inconsistent json_decode() results
| From: | Michiel Sikma | Date: | Wed, 05 May 2010 21:48:47 +0000 |
| Subject: | Re: Inconsistent json_decode() results | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304925@lists.php.net to get a copy of this message | ||
On 5 May 2010 22:14, Michael Shadle <mike503@gmail.com> wrote:
> -snip-
>
> Ahhhh. I gotcha now. Yeah I started using that just recently either
> 5.2.11 or 5.2.13 (not sure which)
>
> You can typecast an object to an array that easily? I was unaware.
>
Yep, it's that easy. :-)
// array(1) {
// [0]=>
// int(1)
// }
var_dump((array)1);
// array(1) {
// [0]=>
// string(1) "a"
// }
var_dump((array)'a');
// array(1) {
// ["c"]=>
// string(1) "d"
// }
class b {
public $c = 'd';
}
var_dump((array)new b());
Michiel