Re: NewComer Code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux