I have a .php file that takes some information from the parameters in its URL. This was working fine until I realized that each time I called the URL, there would be a different amount of variables.
Example:
www.myurl.com/webserivce?var1=20&var2=30
www.myurl.com/webserivce?var1=20&var2=30&var3=40
If I have 3 variables in my .php file, and only send the URL with 2, it crashes.
One potential work around is that I have 3 variables, and only send 1, I could fill the other 2 with 'NULL' or something like that:
www.myurl.com/webserivce?var1=20&var2=NULL&var3=NULL
I was just wondering if there was a better way.
BTW I am sending this URL request from an iOS app.
function example($param1, $param2 = "", $param3 = null) {}