Re: Constants in strings

From: Date: Fri, 08 Jul 2011 15:38:47 +0000
Subject: Re: Constants in strings
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-313993@lists.php.net to get a copy of this message
On 06/07/11 17:33, Robert Williams wrote:
Where I've made most use of heredocs is when I want to do nothing but define a bunch of long strings in one file.
I find the most useful thing about heredocs is that they don't care about quotation marks, so I often use them for SQL statements where I might have a mixture of ' and " eg. $sql =<<<EoSQL SELECT
    foo AS "Foo"
FROM Bar WHERE baz='quux' EoSQL; -- Peter Ford, Developer phone: 01580 893333 fax: 01580 893399 Justcroft International Ltd. www.justcroft.com Justcroft House, High Street, Staplehurst, Kent TN12 0AH United Kingdom Registered in England and Wales: 2297906 Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17 1XS

« previous php.general (#313993) next »