Forum Moderators: coopster
i thought this would solve the problem, but it causes a Callto undefined function error in the body and i can't understand why, is there something that says a functions cannot be inside an if statement?
I would add some File System folder functions and use an
if (!file_exist()) function) {
GLOB...
} else {
echo "no files exist";
}
This way, the GLOB function won't runb and you won't get the error message.
It can get more complicated and sophisticated than this, but you need to do this, at least I believe so.
It's also worth noting that when using the GLOB_BRACE flag in any version of PHP prior to 4.3.4, PHP will crash if no matches are found.
<?
if (expression) {
//code
function myfunction($var) {
//function code
}
//code
myfunction("this");
} else {
//code
}
?>
i changed to
<?
function myfunction($var) {
//function code
}
if (expression) {
//code
myfunction("this");
} else {
//code
}
?>
and now it is fine
i added an if statemant at the beginning with no thought to the function in the midde of the page
o well, not really important, i suppose it must just be bad syntax
It's all right here:
User-defined functions [php.net]