Golang’s defer statement for PHP

< ?php

function helloGoodbye()
{
    defer($_, function () {
        echo "...n";
    });

    defer($_, function () {
        echo "goodbyen";
    });

    echo "hellon";
}

echo "before hellon";
helloGoodbye();
echo "after goodbyen";

// Output:
//
// before hello
// hello
// ...
// goodbye
// after goodbye