|
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]
|