Re: [PHP-DEV] Is there any interest for object constructor shorthand *just forstdClass*

2020-10-26 Thread Rowan Tommins
On 26/10/2020 09:02, Andreas Bittner wrote: With regards to the JSON looking different when casting to object: ``` json_encode([1,2,3]); // result: [1,2,3] json_encode((object)[1,2,3]); // result: {"0":1,"1":2,"2":3} json_encode([]); // result: [] json_encode((object)[]); // result: {} Than

Re: [PHP-DEV] Is there any interest for object constructor shorthand *just forstdClass*

2020-10-26 Thread Andreas Bittner
I don't follow; is the resulting JSON different if you cast to object, or is there some other reason you prefer an object over using an associative array directly? The by-reference semantics of objects vs arrays in PHP. *shrug* If you want things to be mutable between functions, stick an & in

Re: [PHP-DEV] Is there any interest for object constructor shorthand *just forstdClass*

2020-10-23 Thread Rowan Tommins
On 23 October 2020 21:14:49 BST, Mike Schinkel wrote: >> On Oct 23, 2020, at 2:33 PM, Rowan Tommins >wrote: >> >> I don't follow; is the resulting JSON different if you cast to >object, or is there some other reason you prefer an object over using >an associative array directly? > >The by-refere

Re: [PHP-DEV] Is there any interest for object constructor shorthand *just forstdClass*

2020-10-23 Thread Mike Schinkel
> On Oct 23, 2020, at 2:33 PM, Rowan Tommins wrote: > > I don't follow; is the resulting JSON different if you cast to object, or is > there some other reason you prefer an object over using an associative array > directly? The by-reference semantics of objects vs arrays in PHP. > Also, to cl