Reputation: 8565
I have made a script that adds files to a zip (after lots of parsing, etc..) and I have this function:
function _add_file($command)
{
if (!isset($command["source"]) || !isset($command["dest"])) {
return;
}
if (!get_file_info("files/".$command["source"])) {
return;
}
$zip->addFile("files/".$command["source"], $command["destination"]);
}
It gives an error because $zip is not defined in _add_file. How can I let _add_file access the $zip defined in the function that calls it (without _add_file($command, $zip)
)?
Upvotes: 0
Views: 155