Re: Inconsistent json_decode() results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5 May 2010 22:14, Michael Shadle <mike503@xxxxxxxxx> 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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux