Q:

Count empty mysql columns in PHP

I'm trying to create a method that counts the empty mysql columns.
My code is as follows:
public function countCompletion() {
        $userData = $this->find(Session::get('user'));
        $userData = $this->_data;

        $completion = 0;

        foreach($userData as $item) {
            if(empty($item)) {
                $completion++;
            }
        }

        die($completion);
    }

The problem is, when I die $completion it just shows nothing, while it should show 2.

A:

According to the documentation, when die (or exit) is called with an integer argument the argument is not printed but is instead passed back to the operating system as an exit code. To get the value to display you will need to return it, then print it from the calling routine.

