Re: What does "<<<" mean?

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

 



On Mon, April 30, 2007 7:19 pm, Richard Davey wrote:
> Greg Donald wrote:
>
>> On 4/30/07, Daevid Vincent <daevid@xxxxxxxxxx> wrote:
>>> > echo <<<EOF
>>> > BROWSER: $_SERVER[HTTP_USER_AGENT]
>>> > EOF;
>>>
>>> Isn't that form (sans quote marks) deprecated and frowned upon?
>>
>> <?php
>>
>> error_reporting( E_ALL );
>>
>> echo <<<EOF
>> BROWSER: $_SERVER[HTTP_USER_AGENT]
>> EOF;
>>
>> Why would cleaner, perfectly error free code be frowned upon?
>
> I'm not dissing heredoc syntax, it has its uses (now and again) but
> it's
> far from "clean", especially when embedded deep in classes - the major
> cause being the delimeters insistance on being at the very start of
> the
> line. It's just *not* pretty IMHO. Certainly not girl code [1]
>
> The frowning surely would be at the mixing of logic and presentation,
> regardless how that mix happens (heredoc, echo, jumping in and out of
> PHP tags, sprintf, etc).

There's some folks that take this presentation/logic separation ideal
a bit TOO far, imho...

I mean, some of the "logic" is all ABOUT presentation, and there's no
actual business/algorithm to it.

Call it GUI logic.  (Or even girl-logic, if you want to push the
metaphor above way too far...) :-)

Choosing heredoc or echo or sprintf in a rigid
thou-shalt-always-use-this fashion as some do often ends up with what
I consider code "cruft".

You end up with:

sprintf("%d", $d);

or

echo <<<EOFOO
Foo!
EOFOO;

and so on, which are just plain silly, really...

I tend to use the right weapon (imho) for the task at hand, and freely
inter-mingle MINOR calculations and GUI-logic in the HTML.

But any heavy lifting or algorithm/business logic goes way at the top
before any <HTML> output.

Works okay for me, for most of a decade now, but drives some folks
nuts.  Oh well.  They don't like my code, they don't have to steal it.
:-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
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