Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #13848 > unrolled thread

What is the purpose of "&" in this code?

Started byrichard <noreply@example.com>
First post2014-06-14 11:08 -0400
Last post2014-06-15 01:25 +0000
Articles 5 — 5 participants

Back to article view | Back to comp.lang.php


Contents

  What is the purpose of "&" in this code? richard <noreply@example.com> - 2014-06-14 11:08 -0400
    Re: What is the purpose of "&" in this code? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-06-14 17:57 +0200
    Re: What is the purpose of "&" in this code? bill <william@TechServSys.com> - 2014-06-14 14:32 -0400
    Re: What is the purpose of "&" in this code? Denis McMahon <denismfmcmahon@gmail.com> - 2014-06-14 20:04 +0000
    Re: What is the purpose of "&" in this code? Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-06-15 01:25 +0000

#13848 — What is the purpose of "&" in this code?

Fromrichard <noreply@example.com>
Date2014-06-14 11:08 -0400
SubjectWhat is the purpose of "&" in this code?
Message-ID<tvhj7dle16f3$.ro2c41zfpmyn.dlg@40tude.net>
foreach($master as &$ma)
    $tmp[] = &$ma["date"];
array_multisort($tmp, $master);
foreach($master as &$ma)
    echo $ma["date"]."<br/>"; 

[toc] | [next] | [standalone]


#13849

FromChristoph Michael Becker <cmbecker69@arcor.de>
Date2014-06-14 17:57 +0200
Message-ID<539c70e1$0$6607$9b4e6d93@newsspool4.arcor-online.net>
In reply to#13848
richard wrote:

> foreach($master as &$ma)
>     $tmp[] = &$ma["date"];
> array_multisort($tmp, $master);
> foreach($master as &$ma)
>     echo $ma["date"]."<br/>"; 

See <http://www.php.net/manual/en/language.references.php> and
<http://www.php.net/manual/en/control-structures.foreach.php>.

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#13850

Frombill <william@TechServSys.com>
Date2014-06-14 14:32 -0400
Message-ID<lni4g1$1ei$1@speranza.aioe.org>
In reply to#13848
On 6/14/2014 11:08 AM, richard wrote:
>
> foreach($master as &$ma)
>      $tmp[] = &$ma["date"];
> array_multisort($tmp, $master);
> foreach($master as &$ma)
>      echo $ma["date"]."<br/>";
>

http://www.php.net/manual/en/language.references.pass.php

[toc] | [prev] | [next] | [standalone]


#13853

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2014-06-14 20:04 +0000
Message-ID<lni9sb$vjq$4@dont-email.me>
In reply to#13848
On Sat, 14 Jun 2014 11:08:48 -0400, richard wrote:

> [code]

Either (a) ask the person who wrote the code, or (b) read the manual 
yourself.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#13854

FromDoug Miller <doug_at_milmac_dot_com@example.com>
Date2014-06-15 01:25 +0000
Message-ID<XnsA34CD9DAF617Ddougmilmaccom@78.46.70.116>
In reply to#13848
richard <noreply@example.com> wrote in news:tvhj7dle16f3$.ro2c41zfpmyn.dlg@40tude.net:

> 
> foreach($master as &$ma)
>     $tmp[] = &$ma["date"];
> array_multisort($tmp, $master);
> foreach($master as &$ma)
>     echo $ma["date"]."<br/>"; 
> 

RTFM, RtS.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web