If-statements

18th June 2022, 09:38

This is a post about if statements and how to use them accordingly (depending on your language of course).

function myMethod(mixed $variable) : bool {
    if ($variable) {
        return true;
    } else {
        return true;
    }
}
function myMethod(mixed $variable) : bool {
    return !!($variable ?? false)
}

Comments

Comments are closed.


Recent posts

PHP Tutorial: How to make your own PHP framework [part 2 of 2]

This is the second part in our “How to make your own PHP framework”-tutorial. Check out the first part of […]

Read more
PHP Tutorial: How to make your own PHP framework [part 1 of 2]

We’ve all been there; “how does a framework work?”, “what is the purpose of a framework?” or maybe even “how […]

Read more