Re: simple question

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

 



On Tue, 2005-02-01 at 01:41 +0000, Pagongski wrote:
> I have this function:
> 
> function supscript($texto)
> {
>    print("<sup>".$texto."</sup>");
> }
> 
> But when i do:
> 
> 	print "2".supscript("3");
> 
> 	I get the "3" before the "2", how is that posible?
> 
> And:
> 
> 	print(supscript("3")."2");
> 
> 	makes the 2 appear before the 3.
> 	I am confused!
> 
> 	Thanks
> 

probably because it calls the function before it calls the main print.

try return instead of print.

example:

function supScript($txt)
{
  return "<sup>{$txt}</sup>";
}

print "2" . supScript("3");

You shouldn't print a function that prints.. ;-)

-Robby


-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | robby@xxxxxxxxxxxxxxx
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
* --- Now hosting PostgreSQL 8.0! ---
****************************************/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux