Re: most powerful php editor

From: Date: Wed, 24 Jan 2007 15:04:37 +0000
Subject: Re: most powerful php editor
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-247698@lists.php.net to get a copy of this message
Miles Thompson wrote:
More seriously, many times I've taken a "It's right, but not working, dammit!" SQL statement, broken it up so it's listed "vertically" and discovered the error. Just my 2 cents worth...
SQL actually does lend itself rather well to normal code style indenting, even though not many seem to do it...Breaking it (and PHP code of course) into 78/80-char lines makes great sense for readability within PHP code: $sql = " SELECT
       (list of fields),
       CASE ... END AS field
       ...
FROM (table) JOIN (table) USING(column) JOIN (table) ON(column=column) ... WHERE
       (condition)
AND
       (
          (sub-condition)
       OR
          (sub-condition)
       )
GROUP BY (column) ... "; These things are a real pain to read without formatting! :-) I think writing unformatted SQL queries is like writing code like "if ($var) { statement; statement; statement; foreach ($var as $v) { statement; statement; statement; } statement; etc. }" jon

« previous php.general (#247698) next »