Skip to content

ch07_exit_early

Daniel Samson edited this page Jul 6, 2022 · 4 revisions

TeensyPHP provides the stop() method when you wish to exist the process early.

stop(int $code = 0)

Example

<?php

function Authentication() {
    // prevent process from going further:
    stop(1)
} 

You should stop() instead of exit(), as it will enable you to write tests, that capture the the output of controller actions.

Clone this wiki locally