Re: [PHP] Constants in strings

2011-07-08 Thread Pete Ford
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

Re: [PHP] Constants in strings

2011-07-06 Thread Robert Cummings
On 11-07-06 02:59 PM, Jim Giner wrote: I LOVE the heredocs tool. I only learned about it a couple of months ago - what a find! It makes generating my html for my web pages so much easier and allows me to include my php vars within the html with much less confusion and simplifies the intermi

Re: [PHP] Constants in strings

2011-07-06 Thread Jim Giner
I LOVE the heredocs tool. I only learned about it a couple of months ago - what a find! It makes generating my html for my web pages so much easier and allows me to include my php vars within the html with much less confusion and simplifies the intermixing of html and php vars - no more s

Re: [PHP] Constants in strings

2011-07-06 Thread Robert Williams
On 2011-07-6 08:09, "ad...@buskirkgraphics.com" wrote: >I use constants in my OOP and I never use the heredoc syntax. Now I am >fearing that I have not taken advantage of something. >My understanding of heredoc syntax as of 5.3 is just a string quoting >right? >Is there an advantage of using th

RE: [PHP] Constants in strings

2011-07-06 Thread admin
> -Original Message- > From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] > Sent: Wednesday, July 06, 2011 10:49 AM > To: ad...@buskirkgraphics.com; 'Dave Wilson'; php-general@lists.php.net > Subject: RE: [PHP] Constants in strings > > &g

RE: [PHP] Constants in strings

2011-07-06 Thread Curtis Maurand
Yeah, that was my answer and I was rebuked for that. ad...@buskirkgraphics.com wrote: >> -Original Message- >> From: Dave Wilson [mailto:dai_bac...@hotmail.com] >> Sent: Wednesday, July 06, 2011 10:11 AM >> To: php-general@lists.php.net >> Subject:

RE: [PHP] Constants in strings

2011-07-06 Thread Ashley Sheridan
> >define('DIR_JAVA', '/js/'); > >When you need to use the JavaScript directory you can do this. > > >There is no true need for the curly brackets to echo out the value of >the constant. > Except for when you're using heredoc, much like in the OPs first post... Thanks, Ash http://www.ashleysher

RE: [PHP] Constants in strings

2011-07-06 Thread admin
> -Original Message- > From: Dave Wilson [mailto:dai_bac...@hotmail.com] > Sent: Wednesday, July 06, 2011 10:11 AM > To: php-general@lists.php.net > Subject: Re: [PHP] Constants in strings > > On Wed, 06 Jul 2011 12:56:21 +0100, Stuart Dallas wrote: > > My

Re: [PHP] Constants in strings

2011-07-06 Thread Dave Wilson
On Wed, 06 Jul 2011 12:56:21 +0100, Stuart Dallas wrote: > My guess is that the preceding $ causes PHP to interpret the next token > "{XYZ}" as a variable or a constant, but without that preceding $ it has > no way to know you're trying to use a constant. As Curtis points out, > the only way to ins

Re: [PHP] Constants in strings

2011-07-06 Thread Ashley Sheridan
>> Any ideas? >> >echo XYZ . "\n"; > > > >--Curtis > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php Which doesn't answer the original question Dave asked... Thanks, Ash http://www.ashleysheridan.co.uk -- Sent from my Android phone wit

Re: [PHP] Constants in strings

2011-07-06 Thread Stuart Dallas
On Wed, Jul 6, 2011 at 12:07 PM, Dave Wilson wrote: > Hi all, > > OK. We all know that constants cannot be accessed directly via their name > in double-quoted or heredoc strings. I knew this already but a read of > the PHP manual got me thinking. > > The manual states that to get the $$ value of

Re: [PHP] Constants in strings

2011-07-06 Thread Curtis Maurand
On 7/6/2011 7:07 AM, Dave Wilson wrote: Output - {XYZ} Attempt 2: Output - {{XYZ}} No luck there. I did encounter one oddity though: Output: PHP Notice: Undefined variable: ABC in /home/wilsond/testScripts/l7.php on line 3 Which appears to mean that PHP is able to pick up the value of the