We have an array:

$myArray = array( "joe"=>"bob", "this"=>"that" );

I know that technically, you shouldn't do the following
to print it out:

echo "Here is a $string, $myArray[joe] with $alot of PHP $variables";

If you have the highest error level on, PHP will display 
an error though if you don't, it makes some assumptions
for you and goes on it's merry way.  Now, supposing you
do have error level set to very high, you cannot do this:

echo "Here is a $string, $myArray['joe'] with $alot of PHP $variables";
(using single quotes)

to stop the error.  You actually have to do this:

echo "Here is a $string, " . $myArray["joe"] . " with $alot of PHP
$variables";

While that works, it makes the code look very fragmented.  
And if you have *alot* of stuff like that all over your page, 
it could get very difficult to read.

First question: Why doesn't the single quote example work?

Second question: Is there any other way (aside from setting
the error level down; we are already doing that and these
questions are purely academic) to do this so the code doesn't
look as fragmented?

Chris

Reply via email to