Re: function return references to nothing
| From: | Aziz Saleh | Date: | Fri, 26 Feb 2016 03:07:03 +0000 |
| Subject: | Re: function return references to nothing | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-325423@lists.php.net to get a copy of this message | ||
On Thu, Feb 25, 2016 at 10:02 PM, Aziz Saleh <azizsaleh@gmail.com> wrote:
>
>
> On Thu, Feb 25, 2016 at 10:00 PM, Михаил Гаврилов <
> mikhail.v.gavrilov@gmail.com> wrote:
>
>> 2016-02-26 3:47 GMT+05:00 Aziz Saleh <azizsaleh@gmail.com>:
>> > Is your code working as expected? In the second call it found matches
>> when
>> > there are no keys matching "ddd"?
>>
>>
>> yes, I wanted to show that if not found leaf ['aaa', 'bbb',
>> 'ddd']
>> then $found variable will be no initialized when function return by
>> reference nothing.
>>
>>
>>
>>
>> --
>> Best Regards,
>> Mike Gavrilov.
>>
>
> Ignoring the notice, what I meant is that both return found, even thou the
> second is indeed not found. So it is not working as expected:
>
>
>
> http://sandbox.onlinephpfunctions.com/code/87ece8cd40ecbc3191a1a24b1713cd0eb5fa7898
>
>
Sorry, I didn't notice you were printing original array and not found. I
would advise you remove all pass by reference logic, it would yield the
same results.
http://sandbox.onlinephpfunctions.com/code/661400ca622b3a2aaa6d3a443ea91359a658a8c4