Re: Re: What does "<<<" mean?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Cummings wrote:
> On Tue, 2007-05-01 at 08:36 -0700, Mattias Thorslund wrote:
>   
>> Man-wai Chang wrote:
>>     
>>> Bash uses only 2. PHP uses 3. And I am using this:
>>>
>>> $sql="
>>>   select ...
>>>     from ....
>>>     left join ...
>>>       on ....
>>>     where .....
>>> ";
>>>       
>> Exactly. I never saw the point in complicating my life with heredocs
>> when both single- and double-quoted strings can contain multiple lines
>> anyway.
>>
>> One thing that does bother me a little with multi-line strings of either
>> variety is that if I want to avoid inserting extra spaces in the string
>> at the beginning of each line after the first, I have to left-align the
>> whole thing and cannot indent it with the rest of my code:
>>
>> if($something){
>>     if($something_else){
>>        $myID = intval($_GET['rowID']);
>>        $sql_pretty =
>>             "SELECT
>>                 field1,
>>                 field2
>>              FROM
>>                 mytable
>>              WHERE
>>                 rowID = $myID";
>>         $sql_ugly =
>> "SELECT
>>     field1,
>>     field2
>> FROM
>>     mytable
>> WHERE
>>     rowID = $myID";
>>     }
>> }
>>
>> Are there perhaps editors that would DISPLAY multi-line quoted strings
>> "indented" to the correct level without inserting extra spaces? Some
>> editors wrap lines to the correct level, which is also much more
>> readable, so what I'm thinking of is a bit similar to that.
>>     
>
> Then you'd have an editor that presents something other than what is
> actually there. Go see Microsoft, I'm sure they create rubbish like
> that.
>
> Cheers,
> Rob.
>   

"something other than what is actually there"

Not at all, Rob! Have you seen how many editors dynamically wrap lines
(Quanta on KDE for instance)? Instead of placing the wrapped line right
smach along the left edge, it indents the following lines under the
first line. It is visually clear that there is no extra white space
because the extra indent has a different background color.

Like this (I used +'s to indicate a different background color, telling
you this isn't whitespace in your code):

if($something){
   $variable = "This text message goes on and on and ever on and and
+++would run right off the edge of my screen but thankfully my editor
+++is smart enough to wrap the lines in a way that also does not
+++ruin the indentation.\n";
}

Now, I would wish for my editor to also indent multi-line strings in the
same fashion. Essentially, the lines of $sql_ugly in my example above
should be displayed in alignment with the indentation:

if($something){
   if($something_else){
      $myID = intval($_GET['rowID']);
      $sql =
++++++"SELECT
++++++   field1,
++++++   field2
++++++FROM
++++++   mytable
++++++WHERE
++++++   rowID = $myID";
    }
}

I doubt Microsoft develops an editor that I could use on my Linux system
for this...

Cheers,

Mattias

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux