& in arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
m2babaey
Forum Contributor
Posts: 364
Joined: Sun May 20, 2007 9:26 am

& in arrays

Post by m2babaey »

Hi
What is the job of the "&" in &options in the code below?
thanks

Code: Select all

    function addSelect($name, $label, $default, &$options) {
         $this->_elements[$name] = array('type' => 'select', 'label' => $label, 'value' => $default,
            'options' => $options);
     }
User avatar
N1gel
Forum Commoner
Posts: 95
Joined: Sun Apr 30, 2006 12:01 pm

Re: & in arrays

Post by N1gel »

The & symbol is used to pass a variable into a function by reference.

You can read about it in the PHP Manual

http://php.mirror.camelnetwork.com/manu ... s.pass.php

Hope this helps

Nigel :D
Post Reply