You are here: Re: .php5 versus .php « PHP Language « IT news, forums, messages
Re: .php5 versus .php

Posted by Kimmo Laine on 02/17/07 13:41

Rik kirjoitti:
> On Sat, 17 Feb 2007 00:54:36 +0100, shimmyshack <matt.farey@gmail.com>
> wrote:
>> yeah, do you know in years of php programming I've only ever
>> concatenated strings when using echo - my bad - although I always use
>> ' instead of " so brownie points there huh! perhaps its time to go
>> read up on some other functions too! sorry for any confusion, I don't
>> think ill be notifying the php doc group!
>
> echo is not a function, it's a construct :P
> Hence the unexpecyed behaviour.
> --Rik Wasmus

Normal functions are also capable of recieveing an arbitrary number of
parameters. Print just isn't programmed to handle them. It's true that
echo is a language construct, but that doesn't make it magical.

Something like this should work: (didn't test thou)

function print_multiple(){
foreach(func_get_args() as $arg)
print($arg);
}

print_multiple('Hello', ' ', 'world!'); // Using commas instead of dots.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

 

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

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