Page 1 of 1
"<<<____SQL" ??
Posted: Wed Jun 13, 2012 11:31 am
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
Re: "<<<____SQL" ??
Posted: Wed Jun 13, 2012 11:33 am
by Benjamin
Re: "<<<____SQL" ??
Posted: Wed Jun 13, 2012 11:55 am
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).
Re: "<<<____SQL" ??
Posted: Wed Jun 13, 2012 12:23 pm
by Christopher
Yes, it is a way to assign strings without using quotes. I recall that quotes also work with multi-line values.
Re: "<<<____SQL" ??
Posted: Wed Jun 13, 2012 1:23 pm
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
Re: "<<<____SQL" ??
Posted: Wed Jun 13, 2012 2:32 pm
by Celauran
And obnoxious. The closing delimiter must be at the beginning of a line, wrecking your code formatting.
Re: "<<<____SQL" ??
Posted: Wed Jun 13, 2012 6:38 pm
by Christopher
Now there's a man who takes his indenting seriously!

Re: "<<<____SQL" ??
Posted: Wed Jun 13, 2012 6:59 pm
by Benjamin
I'm with Celauran on that one. Drives me nuts!!
Re: "<<<____SQL" ??
Posted: Thu Jun 14, 2012 2:33 pm
by Christopher
Another member of the
Indention Squad!
