In Objective-C, I can have a method like this:
+ (id)arrayWithObjects:(id)firstObj, ...;
I can pass as many object as I like, until I pass a nil
in the last argument.
In php, can I have this ability also...? Thank you...
In Objective-C, I can have a method like this:
+ (id)arrayWithObjects:(id)firstObj, ...;
I can pass as many object as I like, until I pass a nil
in the last argument.
In php, can I have this ability also...? Thank you...
In PHP, you can do the same kind of thing -- except you don't have to pass null as a last parameter : just pass the parameters you want to your method.
Then, in this method, use functions such as func_get_args()
to access the parameters it received.