Where do you want to use the variable
$foundFile? Outside of the
if-block? If so, you have a scoping problem, i.e.
$foundFile will be out of scope and gone after the closing '}' of the
if-block.
Maybe you want to store the find results in some global variable (array), or some such...