Re: [PHP] Hashes in strings

2002-05-02 Thread Philip Olson
One thing to note is that constants are not looked for within strings. So: // This is okay but can cause confusion. No errors // are created but many prefer not to do this. $str = "Hello $there[friend], how are you?"; Outside of a string, $there[friend] will indeed seek a constant nam

Re: [PHP] Hashes in strings

2002-05-02 Thread Dan Hardiker
Hi, > I would suggest not to use $hash[var1][var2] instead of > $hash['var1']['var2'] because afaik php will think u mean two constants > ( var1 and var2 ). > Just if it doesnt find these constants it will use them as > $hash['var1']['var2']. Thats correct, php will think they are constants and

Re: [PHP] Hashes in strings

2002-05-02 Thread Markus Mirsberger
Hi, I would suggest not to use $hash[var1][var2] instead of $hash['var1']['var2'] because afaik php will think u mean two constants ( var1 and var2 ). Just if it doesnt find these constants it will use them as $hash['var1']['var2']. Markus Mirsberger "Dan Hardiker" <[EMAIL PROTECTED]> schrieb

RE: [PHP] Hashes in strings

2002-05-02 Thread Steve Bradwell
Not really sure but str has to be $str, and I usually do print lines like this $str = "I can NOT use ".$hash['vars']." in strings"; the . will concat the strings together. Hope this helps, -Steve -Original Message- From: Ferry van Steen [mailto:[EMAIL PROTECTED]] Sent: Thursday, May

RE: [PHP] Hashes in strings

2002-05-02 Thread Ferry van Steen
Thanks for the replies peoples :-) -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]] Sent: donderdag 2 mei 2002 11:13 To: 'Ferry van Steen'; [EMAIL PROTECTED] Subject: RE: [PHP] Hashes in strings > -Original Message- > From: Ferry van Stee

RE: [PHP] Hashes in strings

2002-05-02 Thread Ford, Mike [LSS]
> -Original Message- > From: Ferry van Steen [mailto:[EMAIL PROTECTED]] > Sent: 02 May 2002 09:42 > > why do these work: > $vars = "vars"; > $ar[0] = "arrays"; > $hash['vars'] = "hashes"; > str = "I can use $vars in strings"; > str = "I can use $ar[0] in string"; > > while this one doesn

Re: [PHP] Hashes in strings

2002-05-02 Thread Alexander Weber
Ferry van Steen wrote: > while this one doesn't: > str = "I can NOT use $hash['vars'] in strings"; Try this one: str = "I can NOT use ".$hash['vars']." in strings"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Hashes in strings

2002-05-02 Thread Dan Hardiker
Hi, I think this will accomplish what your trying to achieve. $str = "I can use $hash[vars] in strings"; However, this will not work for multi dimensional arrays... eg: $hash['var']['var2'] = "Elephant"; $str = "I can NOT use $hash[var][var2] in strings"; will output "I can NOT use Array[v

Re: [PHP] Hashes in strings

2002-05-02 Thread Justin French
I don't know the answer to why, but you can do this: $str = "I can use ".$hash['vars']." in strings"; :) Justin French Creative Director http://Indent.com.au on 02/05/02 6:42 PM, Ferry van Steen ([EMAIL PROTECTED]) wrote: > Hey there, > > why do th