Difference between revisions of "Heredoc"

From EditPlus Wiki
Jump to: navigation, search
(http://timae.strefa.pl/news1838.html)
(removing spam, yay)
 
Line 1: Line 1:
[http://timae.strefa.pl/news1838.html electric slide dance instruction video] [http://coflemin.interfree.it/topic-1537.html etree bit torrent] [http://vastack.interfree.it/20081201-keiko-news-video.html keiko news video] [http://wejolly.strefa.pl/nagla-video-20081121.html nagla video clip download] [http://miminerv.strefa.pl/20081124-actionscript-loadmovie.html actionscript loadmovie tutorial]
 
[http://xlac4tr.ifrance.com/big-island-hawaii-2008-11-27.htm big island hawaii mls listings] [http://fixpasxbu.ifrance.com/news-623.html adderall and dehydration] [http://imvasque.interfree.it/sitemap.html http] [http://brqashenv.ifrance.com/news-afternoon-delight-2008-11-26.html afternoon delight will ferrel video] [http://imvasque.interfree.it/article859.html most requested video]
 
[http://hedewayn.strefa.pl/comment-1184.htm bbcnews] [http://woelgin.interfree.it/topic-703.html di figaro le mozart nozze] [http://hedewayn.strefa.pl/comment-1866.htm tylers estate agents cambridge uk] [http://miminerv.strefa.pl/20081125-new-pixar-movie.html new pixar movie] [http://haschucka.interfree.it/sitemap.html index]
 
[http://crbaldwi.interfree.it/sitemap.htm map] [http://virosaur.strefa.pl/topic1740.htm basket gourmet tea] [http://anabascom.interfree.it/1044393486/ alnoor world.com] [http://labooth.strefa.pl/sitemap.htm http] [http://timae.strefa.pl/news944.html juvenile music video]
 
[http://liendar.ifrance.com/page1565.html netop school serial] [http://tpasrnrfi.ifrance.com/page1463.html mazda car dealership] [http://ezpascal.strefa.pl/fund-raisers.htm school fund raiser] [http://coflemin.interfree.it/topic-561.html kung fu movies on dvd] [http://tpasrnrfi.ifrance.com/page412.html salsa dance video free]
 
[http://labreann.interfree.it/macgyver-movie.htm macgyver movie] [http://timae.strefa.pl/news686.html jesse mccartney ringtones lg] [http://coflemin.interfree.it/topic-1307.html ballistic steel] [http://xlac4tr.ifrance.com/teenie-thong-2008-12-04.htm teenie thong] [http://virosaur.strefa.pl/topic1214.htm cartoon rabbit]
 
[http://enpasel.ifrance.com/1069337567.htm job kaiser] [http://clpatric.strefa.pl/funeneou-727.html louis bolle watches] [http://ezpascal.strefa.pl/download-ringtone.htm download ringtone motorola v220] [http://xlac4tr.ifrance.com/bart-having-sex-2008-11-27.htm bart and lisa having sex] [http://enpasel.ifrance.com/1003451154.htm remembrance words]
 
[http://oufokme.ifrance.com/racvarnrd737.htm rar password crackers] [http://kamada.strefa.pl/page210.html mac osx torrent sites] [http://liendar.ifrance.com/page392.html wholesale mini bike replacement parts] [http://lakinkea.strefa.pl/comment-1531.htm wall mounted waterfalls] [http://fixpasxbu.ifrance.com/news-379.html crystal radio set design]
 
[http://sasitkobr.ifrance.com/2008-12-08-dragracing.html dragracing] [http://enpasel.ifrance.com/1022942351.htm busty mature natural] [http://labooth.strefa.pl/lightspeed-free.htm lightspeed free movie] [http://clpatric.strefa.pl/rotral-1756.html audio sliders 3.1 serial] [http://haschucka.interfree.it/news-popcap-games-20081123.html popcap games serial numbers]
 
[http://legoebel.interfree.it/topic1896.htm senses fail bloody romance] [http://virosaur.strefa.pl/topic1564.htm maya 6 serial number mac] [http://kamada.strefa.pl/page1979.html emiliana torrini sunny road video] [http://haschucka.interfree.it/news-tradingplaces-20081124.html tradingplaces estate agents] [http://oufokme.ifrance.com/domdar727.htm fido ringtone]
 
[http://lakinkea.strefa.pl/comment-600.htm tractorbynet] [http://xlac4tr.ifrance.com/affordable-printing-2008-12-05.htm affordable printing services] [http://crbaldwi.interfree.it/1036371269/ attack bear grizzle video] [http://hedewayn.strefa.pl/comment-1744.htm high frequency reciprocating test rig] [http://fokrdarc.ifrance.com/20081206-business-services.htm business voice mail service]
 
[http://timae.strefa.pl/news1544.html hot young girl teen] [http://sasitkobr.ifrance.com/2008-12-04-athens-ga-movie.html athens ga movie theaters] [http://virosaur.strefa.pl/topic1497.htm yakima bike racks] [http://fixpasxbu.ifrance.com/news-984.html randhurst movie] [http://enpasel.ifrance.com/1014206551.htm nine inch nails burn video]
 
[http://brqashenv.ifrance.com/news-indiana-jones-movie-2008-11-30.html indiana jones movie news] [http://virosaur.strefa.pl/topic64.htm emf unbelievable] [http://woelgin.interfree.it/topic-920.html rental riverside video] [http://labooth.strefa.pl/sitemap.htm link] [http://woelgin.interfree.it/topic-1174.html lesbian pussy sucking movie]
 
letotro
 
 
'''Heredoc''' syntax provides a means to delimit a string without using single or double quotes. This can be useful in situations with strings that contain many single or double quotes or that break across multiple lines.
 
'''Heredoc''' syntax provides a means to delimit a string without using single or double quotes. This can be useful in situations with strings that contain many single or double quotes or that break across multiple lines.
  

Latest revision as of 05:41, 16 December 2008

Heredoc syntax provides a means to delimit a string without using single or double quotes. This can be useful in situations with strings that contain many single or double quotes or that break across multiple lines.

EditPlus does not natively support Syntax Highlighting for heredoc strings, however you can modify an .stx file to emulate string highlighting for heredoc strings.

PHP Syntax

In PHP, <<< (three left angle brackets) is the heredoc operator, denoting the beginning of the string. This operator is followed immediately by a custom identifier, which is then used to close the heredoc string. The closing identifier must begin in the first column of the line, containing no other characters except a semicolon (;). There can be no spaces/tabs after or before the identifier or the semicolon.

The following is an example of heredoc string usage:

$str = <<<EOF
Example of string
spanning multiple lines
using heredoc syntax.
EOF;
print $str;

Bash Syntax

In Bash, a here document is a special-purpose code block. It uses a form of I/O redirection to feed a command list to an interactive program or a command, such as ftp, cat, or the ex text editor. A limit string delineates (frames) the command list. The special symbol << designates the limit string. This has the effect of redirecting the output of a file into the stdin of the program or command.

The here document looks like this:

#!/bin/bash
interactive-program <<LimitString
command #1
command #2
...
LimitString

By default bash will interpolate the content of the block like it would in a double-quoted string. If you want to avoid this (for example if your here document contains a script you want to output verbatim) you can put single quotes around your limit string.

user@host> var="hello"
user@host> cat <<LimitString
user@host>  echo $var
user@host>  LimitString
echo hello
user@host> cat <<'LimitString'
user@host>  echo $var
user@host>  LimitString
echo $var


You can also use the following syntax to allow tab characters in front of each line. This is especially useful in scripting to allow indentation.

#!/bin/bash
    interactive-program <<-LimitString
        command #1
        command #2
        ...
    LimitString

Spaces have been used in this example due to the limitations of the Wiki editor, however it should be noted that this syntax only allows tab characters.


See also

FAQ: How do I make EditPlus "correctly" highlight PHP heredoc strings?

External Links