Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #4741
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
| Newsgroups | comp.lang.php |
| Subject | Re: array_walk_recursive and call by reference - possible? |
| Date | Sun, 05 Feb 2012 22:31:31 +0100 |
| Lines | 64 |
| Message-ID | <9p8apjFhc5U1@mid.uni-berlin.de> (permalink) |
| References | <9p7urpFiglU1@mid.uni-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de ud1hpr3O21cmoDAdJGxSFgOzqQLAxRN8csUS19V2tC+3/QnCk= |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.24) Gecko/20111101 Thunderbird/3.1.16 |
| In-Reply-To | <9p7urpFiglU1@mid.uni-berlin.de> |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.php:4741 |
Show key headers only | View raw
Am 05.02.2012 19:07, schrieb M. Strobel:
> Hi,
>
> I have designed an array with occasional arrays as values, to mimic the structure of
> a html select element with optgroup entries.
>
> Now I need some functions like counting all selectable elements, and searching a key.
>
> I thought array_walk_recursive() was appropriate for this task. But now I have a
> problem getting values out of my callback. I could use globals here, but nicer seemed
> to be: an extra function parameter "by reference".
>
> Now I keep getting PHP Deprecated: Call-time pass-by-reference has been deprecated
> in ...
>
> I know I can suppress these messages, but is there an "official" way to pass
> variables by reference with a callback?
>
> I tested all possible combinations, test script attached.
>
> /Str.
script cut off
Maybe I should have shown the result of the test:
strobel@s114-intel:~/projekte/PHP> php test-array-walks.php
PHP Deprecated: Call-time pass-by-reference has been deprecated in
/home/strobel/projekte/PHP/test-array-walks.php on line 38
Deprecated: Call-time pass-by-reference has been deprecated in
/home/strobel/projekte/PHP/test-array-walks.php on line 38
PHP Deprecated: Call-time pass-by-reference has been deprecated in
/home/strobel/projekte/PHP/test-array-walks.php on line 56
Deprecated: Call-time pass-by-reference has been deprecated in
/home/strobel/projekte/PHP/test-array-walks.php on line 56
Number of elements using count(): 5
array_key_exists() does NOT work in sub-arrays
------------------------------
Start run
------------------------------
var before array_walk: (something)
rc = 1, var after array_walk with call by ref: (Karl)
------------------------------
var before array_walk: (something)
rc = 1, var after array_walk with define by ref, call by val: (something)
------------------------------
var before array_walk: (something)
rc = 1, var after array_walk with define by ref + call by ref: (Karl)
------------------------------
Résumé: every working combination of by-ref/by-val gets a deprecated message.
/Str.
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
array_walk_recursive and call by reference - possible? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-05 19:07 +0100 Re: array_walk_recursive and call by reference - possible? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-05 22:31 +0100
csiph-web