Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
-
Live24x7
- Forum Contributor
- Posts: 194
- Joined: Sat Nov 19, 2011 9:32 am
Post
by Live24x7 »
Now that i have started exploring php database class libraries like PDO, have been noticing a term like "<<<____SQL"
What is that ?
Code: Select all
$sql = <<<____SQL
CREATE TABLE IF NOT EXISTS `ticket_hist` (
`tid` int(11) NOT NULL,
`trqform` varchar(40) NOT NULL,
`trsform` varchar(40) NOT NULL,
) ENGINE=ARCHIVE COMMENT='ticket archive';
thanks
-
Live24x7
- Forum Contributor
- Posts: 194
- Joined: Sat Nov 19, 2011 9:32 am
Post
by Live24x7 »
thnks took a look at it
What i could understand -
this is used for is to write strings spanning multiple lines and is capable of parsing
also
Nowdocs are to single-quoted strings (no parsing) what heredocs are to double-quoted strings (parsing).
-
Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Post
by Christopher »
Yes, it is a way to assign strings without using quotes. I recall that quotes also work with multi-line values.
(#10850)
-
Live24x7
- Forum Contributor
- Posts: 194
- Joined: Sat Nov 19, 2011 9:32 am
Post
by Live24x7 »
thats right quotes do work in multiple lines.
so heredocs is just a larger and more clearly visible alternative to double quotes - if i may say
-
Celauran
- Moderator
- Posts: 6427
- Joined: Tue Nov 09, 2010 2:39 pm
- Location: Montreal, Canada
Post
by Celauran »
And obnoxious. The closing delimiter must be at the beginning of a line, wrecking your code formatting.
-
Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Post
by Christopher »
Now there's a man who takes his indenting seriously!

(#10850)
-
Benjamin
- Site Administrator
- Posts: 6935
- Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin »
I'm with Celauran on that one. Drives me nuts!!
-
Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Post
by Christopher »
Another member of the
Indention Squad!

(#10850)