[prev in list] [next in list] [prev in thread] [next in thread] 

List:       quanta
Subject:    Re: [Quanta] Summer of Code 2006
From:       "Aaron D. Campbell" <quanta () ezdispatch ! com>
Date:       2006-05-04 13:37:19
Message-ID: 445A038F.90405 () ezdispatch ! com
[Download RAW message or body]

Andras Mantia wrote:
> On Wednesday 26 April 2006 17:34, Aaron D. Campbell wrote:
>   
>> * I rarely actually use the debugger in Zend (which I actually really
>> like), but I LOVE the way it underlines bad code in red (similar to
>> ow spell checkers do this in almost any program).
>>     
>
> I have no idea how this could be done...
>   
I don't know either, but it's nice.
>> * Handle HEREDOC well.  I find that a LOT of 'php editors' do not
>> handle this well.  Syntax coloring should be like that of a double
>> quoted string, and syntax coloring below should NOT be affected.
>>     
>
> I don't know anything about HEREDOC. Can you explain it?
>
> Andras
>   
heredoc is another syntax for strings.  You can do any of the following 
to show a string (Assume $myvar = 'hello'):
$var = '$myvar world'; //$var is literally '$myvar world';
$var = "$myvar world"; //$var is hello world
$var = <<<YOUR_IDENTIFIER
$myvar world
YOUR_IDENTIFIER;
//$var is hello world
The advantage is that you can have any amount of data, variables are 
parsed, and there is no need to escape and quotes.  I would use it to 
echo html, or to put html into a variable:

$var = <<<MY_TABLE
<table style="width:100%;" cellpadding="0" cellspacing="0">
    <tr class="odd">
       <td>Cell 1</td>
       <td>'Cell 2 has single quotes'</td>
    </tr>
    <tr class="even">
       <td>Cell 1</td>
       <td>'Cell 2 has single quotes'</td>
    </tr>
</table>
MY_TABLE;

you can use it with echo:
echo <<<MY_STUFF
Whatever
You
Want
MY_STUFF;

The main thing is that the identifiers must match, and the ending 
identifier MUST start the line (no characters...including spaces or 
tabs...before it), and be the only thing on the line (other than the 
semi-colon after it).

You can read more here: 
http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

While I'm giving out links, it might be nice to support the alternative 
syntax for control structures too (not sure if it does this yet...I 
don't have Quanta at this computer): http://www.php.net/alternative_syntax

-- 
Aaron D. Campbell
IT Manager
EZ Dispatch

_______________________________________________
Quanta mailing list
Quanta@mail.kde.org
https://mail.kde.org/mailman/listinfo/quanta
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic