Jump to content

php Challenged


george
 Share

Recommended Posts

Where $key and $item are valid text variables containing valid values, Why does this work?

echo "$key. $item<br />\n";

I thought the correct code would be

echo $key . $item . "<br />\n";

Is php responding to the $ to render the value of the variable even when it is within quotes? I thought that by being in quotes, it would render the literal value of what is quoted, and not the variable content.

Link to comment
Share on other sites

why it works well, just becouse it is the right way to use it, you chould use :

echo"$key . $item .\"<br>\n\""; //but why do you have the \n actually? <br> works just fine dont it?

Dont actually understand what the whole challenge thing was about :)..-Kristian_C

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...