php multiline strings in the code  [ 494 views ]

Goal: use multiline strings in the code

I have a simple select statement. I want to store it in a variable but I want to forget the concatenation.
We can use the heredoc syntax.


  $query = <<<TEXT
    select a.*
    FROM (
    select count(*) cnt, s.thunder thd, s.version ver
    from ta_my_stat s
    group by 2, 3
    ) a
    order by 1 desc, 2 asc;
TEXT;

Only one restriction! In the last line we can put only the closer tag with semicolon. No space, tab or other characters accepted before and after of that!

see also: about strings in php

#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }