Please explain this php expression "!$variable"

Posted by DogBot on Stack Overflow See other posts from Stack Overflow or by DogBot
Published on 2012-09-08T14:15:24Z Indexed on 2012/09/08 15:38 UTC
Read the original article Hit count: 178

Filed under:
|

What does an exclamaton mark in front of a variable mean? And how is it being used in this piece of code?

EDIT: From the answers so far I suspect that I also should mention that this code is in a function where one of the parameters is $mytype ....would this be a way of checking if $mytype was passed? - Thanks to all of the responders so far.

 $myclass = null;

    if ($mytype == null && ($PAGE->pagetype <> 'site-index' && $PAGE->pagetype <>'admin-index')) {
        return $myclass;
    }
    elseif ($mytype == null && ($PAGE->pagetype == 'site-index' || $PAGE->pagetype =='admin-index')) {
        $myclass = ' active_tree_node';
        return $myclass;
    }
    elseif (!$mytype == null && ($PAGE->pagetype == 'site-index' || $PAGE->pagetype =='admin-index')) {
        return $myclass;
    }`

© Stack Overflow or respective owner

Related posts about php

Related posts about operators