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 im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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[var2] in strings". For this you have to
> jump out of the string and use contcatination... eg:
>
>  $str = "I can use ".$hash[var][var2]." in strings";
>
> will output "I can use Elephant in strings".
>
> Hope that helps :)
>
> --
> Dan Hardiker [[EMAIL PROTECTED]]
> ADAM Software & Systems Engineer
> First Creative Ltd
>
> > Hey there,
> >
> > 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't:
> > str = "I can NOT use $hash['vars'] in strings";
> >
> > Kind regards
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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

Reply via email to