Possible duplicate:with the name PHP optional arguments?
I want to do this:
function they_said($alice = "", $bob = "", $charlie = "") { echo "Alice said '$alice'"; echo "Bob said '$bob'"; echo "Charlie said '$charlie'"; } they_said($charlie => "Where are the cookies!?");
That way, I can ignore passing the first two arguments and just pass the one I want.
Here is an example in python.
No, but you can pass an array:
function they_said($persons) { foreach ($persons as $person => $text) { echo "$person said '$text'"; } } they_said( array('charlie' => 'Where are the cookies!?') );