Jump to content

add variable into function


jaymc

Recommended Posts

Lets say I have a function set out like this

 

function beans($a,$b) {
  // DO STUFF
}

 

I have used this 100's of times in various scripts.. however, I now need to change this function to look like

 

function beans($a,$b,$c) {
  // DO STUFF
}

 

 

Is there a way to call the function like beans($a,$b) or beans($a,$b,$c) so that if $c is not used it is simple ignored, as apposed to javascript giving an error

 

I do not want to change all occurances of this function if I do not have to

 

Thank you!

Link to comment
https://forums.phpfreaks.com/topic/133796-add-variable-into-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.