Skip to content
github-actions edited this page Mar 26, 2026 · 1 revision

Executes a callback within a controlled scope, ensuring resources are released at the end.

This function MUST create a Defer instance, pass it to the factory, and execute the callback. The Defer instance SHALL be unset after execution.


  • Full name: using
  • Defined in: src/functions.php

Parameters

Parameter Type Description
$factory callable a function that receives the Defer and returns the resource
$callback callable a function that receives the resource and executes the desired logic

Return Value

mixed

the return value of the callback

Clone this wiki locally