I have a function a. That is re used in many times without any problem. But now i cant call the function.This is my function
function a($a,&$b){
// functions code here
}
I calling function a like this.
a(3,null);
Whats the error with my code?
You’ll see that you get an error message along the lines of
This is because your function is saying that its second parameter is a reference (i.e.
&$b) and this requires that you pass a variable. You are actually passingnullwhich is not a variable, hence the problem.If you require the second parameter as a reference (and one way of fixing this might be to remove that requirement) pass along a variable that is set to null. E.g.