Answer the question
In order to leave comments, you need to log in
One PHP works in a function with no variable set and the other doesn't, why?
This function works for me, but it does not work for another PHP, what does it depend on?
test($test);
function test($test = "") {
echo "123";
}
Answer the question
In order to leave comments, you need to log in
In one PHP runs without any errors,Just because you don't see them doesn't mean they don't exist.
Error reporting is enabled in one place, disabled in another. A variable must be defined before it can be used. Or, if it is defined elsewhere, then you can add before calling the function:
if (!isset($test)) { // Если переменная не определена
$test = false; // Определим её
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question