Re: $menu->append( &new GtkMenuItem) can't be written that way ?
| From: | Andrei Zmievski | Date: | Mon, 09 Apr 2001 21:37:37 +0000 |
| Subject: | Re: $menu->append( &new GtkMenuItem) can't be written that way ? | ||
| References: | 1 | Groups: | php.gtk |
| Request: | Send a blank email to php-gtk+get-1330@lists.php.net to get a copy of this message | ||
On Mon, 09 Apr 2001, Markus Fischer wrote:
> Hi,
>
> $menu = &new GtkMenu();
> foreach( $menuitems as $menuitem)
> $menu->append( &new GtkMenuItem( $menuitem));
>
> does not work, getting parse error in the 3rd line:
>
> parse error, expecting
T_VARIABLE' or '$''
>
> Instead it must be writte this way :
>
> $menu = &new GtkMenu();
> foreach( $menuitems as $menuitem) {
> $tmp = &new GtkMenuItem( $menuitem);
> $menu->append( $tmp);
> }
Just do this:
$menu->append(new GtkMenuItem($menuItem));
&new works only for assignments.
-Andrei
* "UNIX, isn't that some archaic form of DOS?" - our job applicant *