Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

I surely do hope that's a syntax error. -- Larry Wall in <199710011752.KAA21624@wall.org>


devel / comp.lang.php / ArrayObject class unusable as array

SubjectAuthor
* ArrayObject class unusable as arrayalex
`* Re: ArrayObject class unusable as arrayArno Welzel
 `* Re: ArrayObject class unusable as arrayalex
  `* Re: ArrayObject class unusable as arrayArno Welzel
   `* Re: ArrayObject class unusable as arrayalex
    `* Re: ArrayObject class unusable as arrayArno Welzel
     `* Re: ArrayObject class unusable as arrayalex
      +- Re: ArrayObject class unusable as arrayJerry Stuckle
      `- Re: ArrayObject class unusable as arrayArno Welzel

1
ArrayObject class unusable as array

<sddtvf$11ug$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=298&group=comp.lang.php#298

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!P5/71iTN5k21vE+LdpDjUA.user.46.165.242.91.POSTED!not-for-mail
From: 1j9448a02@lnx159sneakemail.com.invalid (alex)
Newsgroups: comp.lang.php
Subject: ArrayObject class unusable as array
Date: Fri, 23 Jul 2021 10:17:51 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sddtvf$11ug$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="34768"; posting-host="P5/71iTN5k21vE+LdpDjUA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
X-Mozilla-News-Host: news://news.aioe.org:119
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: it-IT
 by: alex - Fri, 23 Jul 2021 08:17 UTC

Why?

Here is the demonstration:

array_merge(
new ArrayObject,
new ArrayObject,
);

Warning: array_merge(): Expected parameter 1 to be an array, object given

Re: ArrayObject class unusable as array

<ilvkcuFls6iU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=300&group=comp.lang.php#300

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: usenet@arnowelzel.de (Arno Welzel)
Newsgroups: comp.lang.php
Subject: Re: ArrayObject class unusable as array
Date: Fri, 23 Jul 2021 12:36:14 +0200
Lines: 22
Message-ID: <ilvkcuFls6iU1@mid.individual.net>
References: <sddtvf$11ug$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 7bit
X-Trace: individual.net TLxU84fQV1gND7gSlRtQxAP6iT/EhwqPTHy7MVTazmD7K9+aQf
Cancel-Lock: sha1:sD4jrvKkFM4dqxM1uJ9I/PGxy3g=
In-Reply-To: <sddtvf$11ug$1@gioia.aioe.org>
 by: Arno Welzel - Fri, 23 Jul 2021 10:36 UTC

alex:

> Why?
>
> Here is the demonstration:
>
> array_merge(
> new ArrayObject,
> new ArrayObject,
> );
>
>
> Warning: array_merge(): Expected parameter 1 to be an array, object given

Yes - this is the expected result. That's why there is getArrayCopy():

<https://www.php.net/manual/en/arrayobject.getarraycopy.php>

--
Arno Welzel
https://arnowelzel.de

Re: ArrayObject class unusable as array

<sdgfq4$nd3$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=306&group=comp.lang.php#306

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!XeyDHBeMmIt7nb5KMmJyiQ.user.46.165.242.91.POSTED!not-for-mail
From: 1j9448a02@lnx159sneakemail.com.invalid (alex)
Newsgroups: comp.lang.php
Subject: Re: ArrayObject class unusable as array
Date: Sat, 24 Jul 2021 09:34:28 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sdgfq4$nd3$1@gioia.aioe.org>
References: <sddtvf$11ug$1@gioia.aioe.org> <ilvkcuFls6iU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="23971"; posting-host="XeyDHBeMmIt7nb5KMmJyiQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: it-IT
 by: alex - Sat, 24 Jul 2021 07:34 UTC

Il 23/07/21 12:36, Arno Welzel ha scritto:
> alex:
>
>> Why?
>>
>> Here is the demonstration:
>>
>> array_merge(
>> new ArrayObject,
>> new ArrayObject,
>> );
>>
>>
>> Warning: array_merge(): Expected parameter 1 to be an array, object given
>
> Yes - this is the expected result. That's why there is getArrayCopy():
>
> <https://www.php.net/manual/en/arrayobject.getarraycopy.php>
>
>

class MyClass {
function __toString(){
return __CLASS__;
}
}

function my_function(string $string){
echo "$string\n";
}

echo "Object to string implicit conversion: OK \n";
my_function(
new MyClass
);

echo "Object to array implicit conversion: ERROR \n";
array_merge(
new ArrayObject,
new ArrayObject,
);

Output:

Object to string implicit conversion: OK
MyClass
Object to array implicit conversion: ERROR

Warning: array_merge(): Expected parameter 1 to be an array, object
given in /home/rino/Scaricati/esperimenti/merge-ArrayObject.php

Why?

Re: ArrayObject class unusable as array

<im5jrrFsqrkU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=318&group=comp.lang.php#318

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: usenet@arnowelzel.de (Arno Welzel)
Newsgroups: comp.lang.php
Subject: Re: ArrayObject class unusable as array
Date: Sun, 25 Jul 2021 19:03:55 +0200
Lines: 25
Message-ID: <im5jrrFsqrkU1@mid.individual.net>
References: <sddtvf$11ug$1@gioia.aioe.org> <ilvkcuFls6iU1@mid.individual.net>
<sdgfq4$nd3$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 7bit
X-Trace: individual.net wDLIcbGdnrVrl1PlLCR7KARIz9A5oDltSeBgRlSC1UimjnrChC
Cancel-Lock: sha1:WYmd5fRYM9Ff0ELzHSVY7cVkvDI=
In-Reply-To: <sdgfq4$nd3$1@gioia.aioe.org>
 by: Arno Welzel - Sun, 25 Jul 2021 17:03 UTC

alex:

[...]
> echo "Object to array implicit conversion: ERROR \n";
> array_merge(
> new ArrayObject,
> new ArrayObject,
> );
>
> Output:
>
> Object to string implicit conversion: OK
> MyClass
> Object to array implicit conversion: ERROR
>
> Warning: array_merge(): Expected parameter 1 to be an array, object
> given in /home/rino/Scaricati/esperimenti/merge-ArrayObject.php

Because ArrayObject() is not an array.

See <https://www.php.net/manual/en/class.arrayobject.php>

--
Arno Welzel
https://arnowelzel.de

Re: ArrayObject class unusable as array

<sdlou2$1j06$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=319&group=comp.lang.php#319

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!XeyDHBeMmIt7nb5KMmJyiQ.user.46.165.242.91.POSTED!not-for-mail
From: 1j9448a02@lnx159sneakemail.com.invalid (alex)
Newsgroups: comp.lang.php
Subject: Re: ArrayObject class unusable as array
Date: Mon, 26 Jul 2021 09:40:50 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sdlou2$1j06$1@gioia.aioe.org>
References: <sddtvf$11ug$1@gioia.aioe.org> <ilvkcuFls6iU1@mid.individual.net>
<sdgfq4$nd3$1@gioia.aioe.org> <im5jrrFsqrkU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="52230"; posting-host="XeyDHBeMmIt7nb5KMmJyiQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: it-IT
 by: alex - Mon, 26 Jul 2021 07:40 UTC

Il 25/07/21 19:03, Arno Welzel ha scritto:
> alex:
>
> [...]
>> echo "Object to array implicit conversion: ERROR \n";
>> array_merge(
>> new ArrayObject,
>> new ArrayObject,
>> );
>>
>> Output:
>>
>> Object to string implicit conversion: OK
>> MyClass
>> Object to array implicit conversion: ERROR
>>
>> Warning: array_merge(): Expected parameter 1 to be an array, object
>> given in /home/rino/Scaricati/esperimenti/merge-ArrayObject.php
>
> Because ArrayObject() is not an array.
>
> See <https://www.php.net/manual/en/class.arrayobject.php>
>

mmmmhhhhhhhhhh...
Just like MyClass is not a string... :|

Re: ArrayObject class unusable as array

<im7g50F9uq6U1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=322&group=comp.lang.php#322

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: usenet@arnowelzel.de (Arno Welzel)
Newsgroups: comp.lang.php
Subject: Re: ArrayObject class unusable as array
Date: Mon, 26 Jul 2021 12:12:48 +0200
Lines: 45
Message-ID: <im7g50F9uq6U1@mid.individual.net>
References: <sddtvf$11ug$1@gioia.aioe.org> <ilvkcuFls6iU1@mid.individual.net>
<sdgfq4$nd3$1@gioia.aioe.org> <im5jrrFsqrkU1@mid.individual.net>
<sdlou2$1j06$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 7bit
X-Trace: individual.net AeaFFbXQecmu5S/xen4vQQnN8hRPOEbXL2hLQFWYMvENIL5OHm
Cancel-Lock: sha1:kdeXmJ2+APSFBysLDsi/e5he6Ps=
In-Reply-To: <sdlou2$1j06$1@gioia.aioe.org>
 by: Arno Welzel - Mon, 26 Jul 2021 10:12 UTC

alex:

> Il 25/07/21 19:03, Arno Welzel ha scritto:
>> alex:
>>
>> [...]
>>> echo "Object to array implicit conversion: ERROR \n";
>>> array_merge(
>>> new ArrayObject,
>>> new ArrayObject,
>>> );
>>>
>>> Output:
>>>
>>> Object to string implicit conversion: OK
>>> MyClass
>>> Object to array implicit conversion: ERROR
>>>
>>> Warning: array_merge(): Expected parameter 1 to be an array, object
>>> given in /home/rino/Scaricati/esperimenti/merge-ArrayObject.php
>>
>> Because ArrayObject() is not an array.
>>
>> See <https://www.php.net/manual/en/class.arrayobject.php>
>>
>
> mmmmhhhhhhhhhh...
> Just like MyClass is not a string... :|

Yes, but MyClass provides the method __toString() which allows it to be
used *like* a string. When asked for, MyClass will just return a string
representation of itself as the return value of its __toString() method.

However - there is no __toArray() method to rturn an array when needed.
That's the reason why ArrayObject provides getArrayCopy() to get a copy
of the array object as an array value.

Also see:

<https://www.php.net/manual/en/language.oop5.magic.php>
<https://www.php.net/manual/en/arrayobject.getarraycopy.php>

--
Arno Welzel
https://arnowelzel.de

Re: ArrayObject class unusable as array

<sdm3u7$110l$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=324&group=comp.lang.php#324

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!aioe.org!XeyDHBeMmIt7nb5KMmJyiQ.user.46.165.242.91.POSTED!not-for-mail
From: 1j9448a02@lnx159sneakemail.com.invalid (alex)
Newsgroups: comp.lang.php
Subject: Re: ArrayObject class unusable as array
Date: Mon, 26 Jul 2021 12:48:39 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sdm3u7$110l$1@gioia.aioe.org>
References: <sddtvf$11ug$1@gioia.aioe.org> <ilvkcuFls6iU1@mid.individual.net>
<sdgfq4$nd3$1@gioia.aioe.org> <im5jrrFsqrkU1@mid.individual.net>
<sdlou2$1j06$1@gioia.aioe.org> <im7g50F9uq6U1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="33813"; posting-host="XeyDHBeMmIt7nb5KMmJyiQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Content-Language: it-IT
X-Notice: Filtered by postfilter v. 0.9.2
 by: alex - Mon, 26 Jul 2021 10:48 UTC

Il 26/07/21 12:12, Arno Welzel ha scritto:
> alex:
>
>> Il 25/07/21 19:03, Arno Welzel ha scritto:
>>> alex:
>>>
>>> [...]
>>>> echo "Object to array implicit conversion: ERROR \n";
>>>> array_merge(
>>>> new ArrayObject,
>>>> new ArrayObject,
>>>> );
>>>>
>>>> Output:
>>>>
>>>> Object to string implicit conversion: OK
>>>> MyClass
>>>> Object to array implicit conversion: ERROR
>>>>
>>>> Warning: array_merge(): Expected parameter 1 to be an array, object
>>>> given in /home/rino/Scaricati/esperimenti/merge-ArrayObject.php
>>>
>>> Because ArrayObject() is not an array.
>>>
>>> See <https://www.php.net/manual/en/class.arrayobject.php>
>>>
>>
>> mmmmhhhhhhhhhh...
>> Just like MyClass is not a string... :|
>
> Yes, but MyClass provides the method __toString() which allows it to be
> used *like* a string. When asked for, MyClass will just return a string
> representation of itself as the return value of its __toString() method.
>
> However - there is no __toArray() method to rturn an array when needed.
> That's the reason why ArrayObject provides getArrayCopy() to get a copy
> of the array object as an array value.
>
> Also see:
>
> <https://www.php.net/manual/en/language.oop5.magic.php>
> <https://www.php.net/manual/en/arrayobject.getarraycopy.php>
>

However, the method should not be called

class C extends ArrayObject {
function getArrayCopy(){
echo 'CALLED';
}
}

array_merge(
(array) new C,
(array) new C,
);

No output (CALLED)!!!

Re: ArrayObject class unusable as array

<sdmvf1$449$1@jstuckle.eternal-september.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=325&group=comp.lang.php#325

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!jstuckle.eternal-september.org!.POSTED!not-for-mail
From: jstucklex@attglobal.net (Jerry Stuckle)
Newsgroups: comp.lang.php
Subject: Re: ArrayObject class unusable as array
Date: Mon, 26 Jul 2021 14:38:25 -0400
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <sdmvf1$449$1@jstuckle.eternal-september.org>
References: <sddtvf$11ug$1@gioia.aioe.org> <ilvkcuFls6iU1@mid.individual.net>
<sdgfq4$nd3$1@gioia.aioe.org> <im5jrrFsqrkU1@mid.individual.net>
<sdlou2$1j06$1@gioia.aioe.org> <im7g50F9uq6U1@mid.individual.net>
<sdm3u7$110l$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 26 Jul 2021 18:38:25 -0000 (UTC)
Injection-Info: jstuckle.eternal-september.org; posting-host="8ed821935384b0a85132bd776c9cd741";
logging-data="4233"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19W5Bx7OLO5BBQJDW+qbolgGS0pZcbpNps="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:wnwl2+YF/EKw17JwdvcM6WpoRrY=
In-Reply-To: <sdm3u7$110l$1@gioia.aioe.org>
Content-Language: en-US
 by: Jerry Stuckle - Mon, 26 Jul 2021 18:38 UTC

On 7/26/2021 6:48 AM, alex wrote:
> Il 26/07/21 12:12, Arno Welzel ha scritto:
>> alex:
>>
>>> Il 25/07/21 19:03, Arno Welzel ha scritto:
>>>> alex:
>>>>
>>>> [...]
>>>>> echo "Object to array implicit conversion: ERROR \n";
>>>>> array_merge(
>>>>>        new ArrayObject,
>>>>>        new ArrayObject,
>>>>> );
>>>>>
>>>>> Output:
>>>>>
>>>>> Object to string implicit conversion: OK
>>>>> MyClass
>>>>> Object to array implicit conversion: ERROR
>>>>>
>>>>> Warning: array_merge(): Expected parameter 1 to be an array, object
>>>>> given in /home/rino/Scaricati/esperimenti/merge-ArrayObject.php
>>>>
>>>> Because ArrayObject() is not an array.
>>>>
>>>> See <https://www.php.net/manual/en/class.arrayobject.php>
>>>>
>>>
>>> mmmmhhhhhhhhhh...
>>> Just like MyClass is not a string... :|
>>
>> Yes, but MyClass provides the method __toString() which allows it to be
>> used *like* a string. When asked for, MyClass will just return a string
>> representation of itself as the return value of its __toString() method.
>>
>> However - there is no __toArray() method to rturn an array when needed.
>> That's the reason why ArrayObject provides getArrayCopy() to get a copy
>> of the array object as an array value.
>>
>> Also see:
>>
>> <https://www.php.net/manual/en/language.oop5.magic.php>
>> <https://www.php.net/manual/en/arrayobject.getarraycopy.php>
>>
>
> However, the method should not be called
>
> class C extends ArrayObject {
>     function getArrayCopy(){
>         echo 'CALLED';
>     }
> }
>
> array_merge(
>     (array) new C,
>     (array) new C,
> );
>
> No output (CALLED)!!!

Because you never called the function!

--
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Re: ArrayObject class unusable as array

<imi2tiF3hjrU1@mid.individual.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=326&group=comp.lang.php#326

  copy link   Newsgroups: comp.lang.php
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: usenet@arnowelzel.de (Arno Welzel)
Newsgroups: comp.lang.php
Subject: Re: ArrayObject class unusable as array
Date: Fri, 30 Jul 2021 12:34:27 +0200
Lines: 88
Message-ID: <imi2tiF3hjrU1@mid.individual.net>
References: <sddtvf$11ug$1@gioia.aioe.org> <ilvkcuFls6iU1@mid.individual.net>
<sdgfq4$nd3$1@gioia.aioe.org> <im5jrrFsqrkU1@mid.individual.net>
<sdlou2$1j06$1@gioia.aioe.org> <im7g50F9uq6U1@mid.individual.net>
<sdm3u7$110l$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: 7bit
X-Trace: individual.net WQ3KZVVZWirH/ZOGHPP9mQCvVKoZ1yAWFJFswQL/2OKw5oV90A
Cancel-Lock: sha1:w4JcpYBi71KXmah2Za3R61ZagHQ=
In-Reply-To: <sdm3u7$110l$1@gioia.aioe.org>
 by: Arno Welzel - Fri, 30 Jul 2021 10:34 UTC

alex:

> Il 26/07/21 12:12, Arno Welzel ha scritto:
>> alex:
>>
>>> Il 25/07/21 19:03, Arno Welzel ha scritto:
>>>> alex:
>>>>
>>>> [...]
>>>>> echo "Object to array implicit conversion: ERROR \n";
>>>>> array_merge(
>>>>> new ArrayObject,
>>>>> new ArrayObject,
>>>>> );
>>>>>
>>>>> Output:
>>>>>
>>>>> Object to string implicit conversion: OK
>>>>> MyClass
>>>>> Object to array implicit conversion: ERROR
>>>>>
>>>>> Warning: array_merge(): Expected parameter 1 to be an array, object
>>>>> given in /home/rino/Scaricati/esperimenti/merge-ArrayObject.php
>>>>
>>>> Because ArrayObject() is not an array.
>>>>
>>>> See <https://www.php.net/manual/en/class.arrayobject.php>
>>>>
>>>
>>> mmmmhhhhhhhhhh...
>>> Just like MyClass is not a string... :|
>>
>> Yes, but MyClass provides the method __toString() which allows it to be
>> used *like* a string. When asked for, MyClass will just return a string
>> representation of itself as the return value of its __toString() method.
>>
>> However - there is no __toArray() method to rturn an array when needed.
>> That's the reason why ArrayObject provides getArrayCopy() to get a copy
>> of the array object as an array value.
>>
>> Also see:
>>
>> <https://www.php.net/manual/en/language.oop5.magic.php>
>> <https://www.php.net/manual/en/arrayobject.getarraycopy.php>
>>
>
> However, the method should not be called
>
> class C extends ArrayObject {
> function getArrayCopy(){
> echo 'CALLED';
> }
> }
>
> array_merge(
> (array) new C,
> (array) new C,
> );
>
> No output (CALLED)!!!

Yes, that is what I am talking about all the time!

You CAN NOT cast classes to arrays and you CAN NOT use classes like
arrays. You MUST call the method of the class which gives you the
content as array value:

class C extends ArrayObject {
function getArrayCopy(){
echo 'CALLED';
}
}

$a = new C();
$b = new C();

array_merge(
$a->getArrayCopy(),
$b->getArrayCopy()
)

I have explained all there is to say about now. Please take your time to
understand how classes and types work in PHP before asking again why
your idea does not work.

--
Arno Welzel
https://arnowelzel.de

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor