Re: quickform: creating object with new =& or new =
| From: | Bertrand Mansion | Date: | Sun, 16 Mar 2003 22:49:39 +0000 |
| Subject: | Re: quickform: creating object with new =& or new = | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-4264@lists.php.net to get a copy of this message | ||
<ckline@rightcode.net> wrote :
> Hi all,
>
> I am wondering when creating a new instance of a QuickForm I have seen
> two ways of doing this in the sample documents.
>
> like...
> $form =& new HTML_QuickForm('testing', 'post');
> and like...
> $form = new HTML_QuickForm('testing', 'post');
>
> what is the difference and which is better to use?
Look here:
http://www.php.net/manual/en/language.references.whatdo.php
There is no need to use & when instantiating a QuickForm object, the
constructor does not return a reference.
> Also, (related?) when creating a default for a form item I have seen
> this done two ways:
>
> like this...
> $form->setDefaults(array('fuseaction' =>
> $XFA['XFA_FundingAnnouncements']));
> and like...
> $defaultValues['fuseaction'] =
> '$XFA['XFA_FundingAnnouncements']';
>
> What is the difference with these? Thanks for any help.
This is not the same and actually the second option won't work as you use
single quotes.
These are general PHP questions not really linked to QuickForm, you might
get better answers on the php mailing list.
Bertrand Mansion
Mamasam