Last active
May 4, 2021 21:22
-
-
Save chrisbaswell/5a0c210011b21169c9ae4591900b5da9 to your computer and use it in GitHub Desktop.
dd_on
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Die and dump on the Nth time this function is called | |
*/ | |
if (! function_exists('dd_on')) { | |
function dd_on(int $number, ...$args): void | |
{ | |
if (!isset($GLOBALS['dd'])) { | |
$GLOBALS['dd'] = 0; | |
} | |
if ($GLOBALS['dd'] === $number) { | |
dd(...$args); | |
} | |
$GLOBALS['dd']++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment