Re: NewComer Code
| From: | Rocco CAstoro | Date: | Sat, 15 Nov 2003 16:53:12 +0000 |
| Subject: | Re: NewComer Code | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-22103@lists.php.net to get a copy of this message | ||
Thank you very much, this was exactly the help I was looking for!
"Piotr Pluciennik" <ppluciennik@yahoo.com> wrote in message
news:3FB61342.D17734E2@yahoo.com...
> I'm afraid not...
> this function doesn't return string. Your function prints string...
>
> If you want your function to return string, try below example:
>
> function table4Strings( $string1, $string2, $string3, $string4 )
> {
> return "<table
>
border=1><tr><td>$string1</td><td>$string2</td><td>$string3</td><td>$string4
</td></tr></table>";
>
> }
>
> and use it:
>
> echo table4Strings(1, 2, 3, 4);
>
> HTH
> Piotr
>
> Rocco CAstoro wrote:
>
> > Would this be the best and most efficent way to create a function that
> > accepts four string variables and returns a string that contains an HTML
> > table element, enclosing each of the variables in its own cell :
> >
> > <?php
> > function table4Strings( $string1, $string2, $string3, $string4 )
> > {
> > print "<table border=1>";
> > print "<tr>";
> > print "<td>$string1</td>";
> > print "<td>$string2</td>";
> > print "<td>$string3</td>";
> > print "<td>$string4</td>";
> > print "</tr>";
> > print "</table>";
> > }
> > table4Strings(1, 2, 3, 4);
> > ?>
> >
> > Thanks much, reading Sams teach yourself PHP4 in 24 Hours.. Pretty
> > informative..
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php