View Single Post
Old 04-25-2008, 10:05 PM   #1 (permalink)
delayedinsanity
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default Passing multiple arguments to a function via one variable.

Without setting up null possibilities for every argument, is it possible to pass multiple arguments to a function call via one variables?

ie, in my singleton loader, I have the following;

PHP Code:
$aInstance[$szClass] = new $szClass($szArgs); 
Okay, so now I can pass one argument to the object. What if I wanted to pass two? At first I thought I had the brilliant idea of making $szArgs -> $aArgs instead. Well passing the array straight in there obviously isn't going to work. It's just going to get the word "array" as the argument.

So I thought, what if you reconstructed the array into a string, using the arguments quoting convention of "arg", "arg2", "etc". Should've known before I started trying that it wouldn't work. It just passes it as a string, like it should.

So... I wonder if there's any way to pass multiple arguments to a function call or object call, with only one variable?

This is more for curiosity's sake than anything. I don't have any classes at this point that I even pass a single argument too when I call them. Just one of those random thoughts, "can I do that??".
-m
delayedinsanity is offline  
Reply With Quote