> -----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
> 
> 
> 
> >
> >define('DIR_JAVA', '/js/');
> >
> >When you need to use the JavaScript directory you can do this.
> ><script src="<?php echo DIR_JAVA . 'jquery-1.5.1.js';?>"></script>
> >
> >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.ashleysheridan.co.uk
> --
> Sent from my Android phone with K-9 Mail. Please excuse my brevity.


Ash,
        I have a few questions.
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 the heredoc syntax over single quoted or double 
quoted?

Examples:

Echo 'your constant for the javascript path is '.DIR_JAVA;

Echo <<<EOT
Your constant for the JavaScript path is {{DIR_JAVA}}
EOT; 

I fully understand the syntax but I do not understand the advantages of using 
either.
Is it just a writing style, or is there an advantage to the way it processes, 
speed or something?





 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to