What does this function test?

A function wrote by a co-worker:

function test($what, $where) {
    if (!empty($where)) {
        if (!empty($where[$what])) {
            return $where[$what];
        } else {
            return '';
        }
    } else {
        return '';
    }
}

When I had a look at this function I immediatlly tought: Test? What does it test? Thankfully there’s the $what argument! And look! A $where argument too!

WTF? Folks, name your functions and variables properly.


Posted

in

by

Tags:

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.