You should at least set the type to $ in this line:
function validate($data, $data2 = 0, $type)
at NULL or '' , as you can see here:
function validate($data, $data2 = 0, $type = null)
PHP allows you to set a value for parameters, but you cannot define a parameter WITHOUT a given value AFTER a parameter that HAVE the set value. Therefore, if you need to always specify the third parameter, you need to switch the second and third as follows:
function validate($data, $type, $data2 = 0)
source share