You are here: Re: [PHP] Problem using return from a class. « PHP « IT news, forums, messages
Re: [PHP] Problem using return from a class.

Posted by Ben Edwards on 02/10/05 05:05

On Wed, 9 Feb 2005 16:12:58 +0800, Jason Wong <php-general@gremlins.biz> wrote:
> On Wednesday 09 February 2005 01:33, Ben Edwards (lists) wrote:
>
> > > Maybe you should post a bit of code to illustrate your problem ;)
> >
> > I'me just doing:-
> >
> > return $radio_html;
> >
> > as the last line of the method.
> >
> > If I do
> >
> > echo $radio_html;
> >
> > The condense of the variable gets outputted.
> >
> > I could post the method here but its a bit long.
>
> You only need to post concise code that illustrates your problem, a one
> liner to return a value is all the that your method needs.

All I woul post them would be 'retrun $radio_htlm' I will post the
end of the method:

if ( $columns == 0 ) {
$radio_html .= $this->manditoryStar( $manditory );
} else {
if ( $manditory ) {
$radio_html .=
"<tr><td colspan=$columns><p class=NormalText
><font color=red size=+1>" .
"*</font> You must select at least one option" .
"</font></p></td></tr>";
}
$radio_html .= "</table>";
}

$radio_html .= "\n\n<!--nend presenter.renderRadioReal-->\n\n";

// really nagst hack as rtturn not working
echo $radio_html;
return $radio_html;

++$index;
}

This works becouse I echo the varable, but not ideal. The method call
is echo $object->method(...). If the return was working I would get
the code returned twice, but I only get it returned once. without the
'nasty hack' I get nothing;(.

Ben

> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> New Year Resolution: Ignore top posted posts
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> --
> Ben Edwards - Bristol, UK, England
> WARNING:This email contained partisan views - dont ever accuse me of
> using the veneer of objectivity
> If you have a problem emailing me use
> http://www.gurtlush.org.uk/profiles.php?uid=4
> (email address this email is sent from may be defunct)
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация