2

I need to send two parameters to a shutdown function on php. The shutdown function is

function shutdown($newfile,$back_file)
{
        if(file_exists("../Content/8/$newfile")){
            unlink("../Content/8/$newfile");
        }
        if(file_exists("../Content/8/$back_file")){
            unlink("../Content/8/$back_file");
        }
    echo "Script executed with success $back_file", PHP_EOL;
}

As far as I know is, I can declare and register the function as below :

register_shutdown_function('shutdown');

Is there a way that I can send those two parameters to the function?

Thanks!

1

1 Answer 1

4

Yes you should add two parameters in register_shutdown_function like this:

register_shutdown_function('shutdown', $newFile, $previousFile);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.