Re: Re: Wrapping long if statements

From: Date: Tue, 16 Nov 2004 23:58:45 +0000
Subject: Re: Re: Wrapping long if statements
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-34426@lists.php.net to get a copy of this message
And here's Yet Another Way Of Indenting: if ( (
    (NULL == $name)
    ||
    (0 == strcasecmp($name, $record['name']) )
    ||
    (0 == strcasecmp("$name.{$this->_domain}.", $record['name']) )
) && (
    (NULL == $type)
    ||
    (0 == strcasecmp($type, $record['type']) )
) && (
    (NULL == $data)
    ||
    (0 == strcasecmp($data, $record['data']) )
) ){
           doStuff();
} I found that this makes the entire expression easy to rea from top to bottom, having the seperate comparisons and such horizontally, and their relationships vertically :) Ofcourse, like others said, YMMV Cipri

« previous php.pear.dev (#34426) next »