getAllForms($data=null)
getAllForms() and getAllForms("data")
This will work. But I want to make two optional argument in a function like this:
getAllForms($arg1=null,$arg2=null)
getAllForms() and getAllForms("data")
How can I make this possible?
You can try:
function getAllForms() {
extract(func_get_args(), EXTR_PREFIX_ALL, "data");
}
getAllForms();
getAllForms("a"); // $data_0 = a
getAllForms("a", "b"); // $data_0 = a $data_1 = b
getAllForms(null, null, "c"); // $data_0 = null $data_1 = null, $data_2 = c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With