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

Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-24 Thread Jan G.B.
2010/3/24 Marten Lehmann > Hello, > > > dan...@daniel-laptop:~$ php test.php> /dev/null >> Error 1 >> Error 2 >> dan...@daniel-laptop:~$ ./src/php-5.2.12/sapi/cli/php test.php> >> /dev/null >> Error 1 >> Error 2 >> > > well, using php-cli instead of php-cgi, this finally worked: > > fwrite(ST

Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-24 Thread Daniel Egeberg
On Wed, Mar 24, 2010 at 14:12, Marten Lehmann wrote: > Hello, > >> dan...@daniel-laptop:~$ php test.php>  /dev/null >> Error 1 >> Error 2 >> dan...@daniel-laptop:~$ ./src/php-5.2.12/sapi/cli/php test.php>  /dev/null >> Error 1 >> Error 2 > > well, using php-cli instead of php-cgi, this finally wor

Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-24 Thread Marten Lehmann
Hello, dan...@daniel-laptop:~$ php test.php> /dev/null Error 1 Error 2 dan...@daniel-laptop:~$ ./src/php-5.2.12/sapi/cli/php test.php> /dev/null Error 1 Error 2 well, using php-cli instead of php-cgi, this finally worked: But why doesn't it work with php-cgi? That's a binary that is calle

Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Daniel Egeberg
On Tue, Mar 23, 2010 at 15:50, Jan G.B. wrote: > > > 2010/3/23 Daniel Egeberg >> >> On Tue, Mar 23, 2010 at 11:47, Marten Lehmann wrote: >> > Hello, >> > >> > I found different code examples like this, which use the file handle >> > STDERR >> > just like this: >> > >> > > > fwrite(STDERR, "hello

Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Jan G.B.
2010/3/23 Daniel Egeberg > On Tue, Mar 23, 2010 at 11:47, Marten Lehmann wrote: > > Hello, > > > > I found different code examples like this, which use the file handle > STDERR > > just like this: > > > > > fwrite(STDERR, "hello\n"); > > ?> > > > > Also, the PHP documentation of input/output st

Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Daniel Egeberg
On Tue, Mar 23, 2010 at 11:47, Marten Lehmann wrote: > Hello, > > I found different code examples like this, which use the file handle STDERR > just like this: > > fwrite(STDERR, "hello\n"); > ?> > > Also, the PHP documentation of input/output streams > (http://php.net/manual/de/wrappers.php.php)

Re: [PHP] constants STDOUT, STDERR, STDIN not working in 5.2.x?

2010-03-23 Thread Jan G.B.
2010/3/23 Marten Lehmann > Hello, > > I found different code examples like this, which use the file handle STDERR > just like this: > > fwrite(STDERR, "hello\n"); > ?> > > Also, the PHP documentation of input/output streams ( > http://php.net/manual/de/wrappers.php.php) says: > > "It is recommen

Re: [PHP] CONSTANTS and good coding practice

2004-05-21 Thread Jordi Canals
Al wrote: Can someone explain to me the value of using defined custom constants, in the context of good coding practice. I don't recall ever seeing define() used in the scripts I've seen and only the characteristics are described in the my php book and the php manual; but, not the use. Talking

Re: [PHP] CONSTANTS and good coding practice

2004-05-21 Thread Matt
> From: "Al" [EMAIL PROTECTED] Friday, May 21, 2004 9:02 AM > Subject: [PHP] CONSTANTS and good coding practice > Can someone explain to me the value of using defined custom constants, > in the context of good coding practice. Constants are useful anywhere you find yourself typing a constant (

Re: [PHP] Constants

2004-03-23 Thread Jakes
Thanks, will do. "Red Wingate" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Give this a read: http://marc.theaimsgroup.com/?l=php-dev&m=107936530102181&w=2 Am Dienstag, 23. März 2004 15:16 schrieb Red Wingate: > IIRC it was changed to > self::CONST_NAME recently > > interface Se

Re: [PHP] Constants

2004-03-23 Thread Red Wingate
Give this a read: http://marc.theaimsgroup.com/?l=php-dev&m=107936530102181&w=2 Am Dienstag, 23. März 2004 15:16 schrieb Red Wingate: > IIRC it was changed to > self::CONST_NAME recently > > interface Settings { >const UNAME = "somename"; >const PWORD = "password"; >const SERVER = "

Re: [PHP] Constants

2004-03-23 Thread Red Wingate
IIRC it was changed to self::CONST_NAME recently interface Settings { const UNAME = "somename"; const PWORD = "password"; const SERVER = "localhost"; } class Conn implements Settings { public function __construct(){ $dbConn = mysql_connect(self::SERVER, self::UNAME, self

Re: [PHP] Constants

2004-03-23 Thread Jakes
If you define constants with in a interface and then implement that interface it does not work on 5RC1 This should work, but it displays the constant name rather than value it references interface Settings { const UNAME = "somename"; const PWORD = "password"; const SERVER = "localhost";

RE: [PHP] Constants

2004-03-23 Thread Jay Blanchard
[snip] Not too fast. >From http://www.php.net/zend-engine-2.php PHP 5 introduces per-class constants: [/snip] My bad. Still not a bug. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Constants

2004-03-23 Thread Vincent Jansen
Not too fast. >From http://www.php.net/zend-engine-2.php PHP 5 introduces per-class constants: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Constants

2004-03-23 Thread Jay Blanchard
[snip] displayFoo(); ?> The results should display "hello world", but it prints out MY_FOO. [/snip] This is not a bug, but a misunderstanding of constants. You have not defined the constant define("MY_FOO", "hello world."); http://us4.php.net/constants -- PHP General Mailing List (http://

Re: [PHP] Constants in class definitions

2004-02-23 Thread Adam Bregenzer
On Tue, 2004-02-24 at 09:26, Toro Hill wrote: > Here's the situation: > PHP 4.3.4 > Apache 1.3.29 > MMCache 2.4.6 > > I'm ending up with some garbage in certain class variables. > The code runs fine without MMCache disabled. > There seems to be a very specific circumstances under which the error

Re: [PHP] Constants in class definitions

2004-02-23 Thread Toro Hill
Hi Adam. I was wondering if using defined constants in class definitions is completely legal (or even good practice) in PHP. I've looked throught the PHP documentation and from what I can tell it is legal. However, I've had some problems with Turck MMCache and class definitions that are similar to

Re: [PHP] Constants in class definitions

2004-02-23 Thread Adam Bregenzer
On Tue, 2004-02-24 at 08:22, Toro Hill wrote: > I've looked throught the PHP documentation and from what I can > tell it is legal. I'm using PHP4.3.4, and haven't had any problems with > class definitions like this. I use constants in classes myself without problems. In PHP 5 you can actually d

Re: [PHP] Constants in class definitions

2004-02-23 Thread Richard Davey
Hello Toro, Tuesday, February 24, 2004, 12:22:29 AM, you wrote: TH> Hi all. TH> I was wondering if using defined constants in class definitions TH> is completely legal (or even good practice) in PHP. I see absolutely no reason why not. Constants are just ways of defining non-changing variables,

Re: [PHP] constants

2003-07-21 Thread Haseeb
hi, you can use constants whenever you want something whose value you don't want changed accidently.for e.g. i use a constant to keep track of the path. if i am at the root level then i store "./" in it. and if i am one folder under the root then i store "../"  in it. now as i tend to name va

RE: [PHP] Constants in heredoc strings?

2003-06-27 Thread Ford, Mike [LSS]
-Original Message- From: Jeff Stewart Is there a way to expand constants in heredoc strings without assigning the constant's value to a variable first? -- No. Cheers! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.

Re: [PHP] Constants and "Here Document" Interpolation

2003-03-01 Thread Ernest E Vogelsinger
At 16:56 01.03.2003, Daniel R. Hansen said: [snip] >Can anyone tell me if it is possible (and how) to use defined constants >within "here document" content? I've not been successful finding anything >on this in the online docs. [snip]

RE: [PHP] Constants and "Here Document" Interpolation

2003-03-01 Thread Danny Shepherd
Hello, It doesn't look like it - a note in the constants manual entry reads: "PHP has no way of recognizing the constant from any other string of characters within the heredoc block" Danny. -Original Message- From: Daniel R. Hansen [mailto:[EMAIL PROTECTED] Sent: 01 March 2003 15:57 To

Re: [PHP] "Constants" for dummies, please?

2003-02-21 Thread Philip Olson
Some thoughts on variables and constants: a) You can't redefine a constant but can redefine a variable. b) Constants are autoglobal (like superglobals) so for example: Had we not used global $variable, the $variable would not have been available inside the function. But, the

RE: [PHP] constants and case sensitivity

2001-03-30 Thread Johnson, Kirk
I get the same results as you using PHP4. I can't explain this, since constants are supposed to be case sensitive by default. They sure don't act like they are. Looks like a bug to me. Kirk > -Original Message- > From: almir [mailto:[EMAIL PROTECTED]] > Sent: Friday, March 30, 2001 12:44

Re: [PHP] constants inside of a string

2001-01-10 Thread jeremy brand
-- Quoted from Yahoo! homepage, http://www.yahoo.com On Wed, 10 Jan 2001, jeff saenz wrote: > Date: Wed, 10 Jan 2001 12:21:01 -0800 > From: jeff saenz <[EMAIL PROTECTED]> > To: Joe Stump <[EMAIL PROTECTED]> > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] constants inside of

Re: [PHP] constants inside of a string

2001-01-10 Thread jeremy brand
> define(MAX,2); > print "the max is MAX"; > > this obv does not work print "the max is " . MAX; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMA

Re: [PHP] constants inside of a string

2001-01-10 Thread Toby Butzon
ge - From: "Moritz Petersen" <[EMAIL PROTECTED]> Sent: Wednesday, January 10, 2001 3:18 PM Subject: RE: [PHP] constants inside of a string -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]

Re: [PHP] constants inside of a string

2001-01-10 Thread Joe Stump
I'm not sure about that one - I think most variables work. No better way to find out than to try it ;o) --Joe On Wed, Jan 10, 2001 at 12:21:01PM -0800, jeff saenz wrote: > what about inside of a here doc > > print << this is the MAX > HERE > > Joe Stump wrote: > > > print "the max is ".M

Re: [PHP] constants inside of a string

2001-01-10 Thread jeff saenz
what about inside of a here doc print << print "the max is ".MAX; > > --Joe > > On Wed, Jan 10, 2001 at 12:12:08PM -0800, jeff saenz wrote: > > how do you use defines inside of a string... > > > > e.g. > > > > define(MAX,2); > > print "the max is MAX"; > > > > this obv does not work > >

Re: [PHP] constants inside of a string

2001-01-10 Thread Joe Stump
print "the max is ".MAX; --Joe On Wed, Jan 10, 2001 at 12:12:08PM -0800, jeff saenz wrote: > how do you use defines inside of a string... > > e.g. > > define(MAX,2); > print "the max is MAX"; > > this obv does not work > > jeff > > > -- > PHP General Mailing List (http://www.php.net/

RE: [PHP] constants inside of a string

2001-01-10 Thread Moritz Petersen
> how do you use defines inside of a string... > > e.g. > > define(MAX,2); > print "the max is MAX"; print "the max is " . MAX; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list a