You are here: Re: [PHP] simple question « PHP « IT news, forums, messages
Re: [PHP] simple question

Posted by Robert Cummings on 02/01/05 03:50

On Mon, 2005-01-31 at 20:41, 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!

Your second example does not print the 2 before the 3. And the reason
your first example prints the 3 before the 2 is because the the print
inside the function prints first because the print that contains the
call to it can't print until it receives the return value form the
function. What you probably want is the following:

function supscript($texto)
{
return "<sup>".$texto."</sup>";
}

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

--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

 

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

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