Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

troy beckett
troy beckett
12,035 Points

Help understanding php syntax?

Trying to learn php so I'm following some tutorials through a book. I understand what the book is teaching but it doesn't take time to explain why it writes things in certain ways.

Why would you write php code like this, what is the purpose:

1.

<form method=\"POST\"

why use the back slashes.

WHERE email =  ' ".$email." '

what are the dots and slashes doing either side of the variable

1 Answer

David Bath
David Bath
25,940 Points

The backslashes are used to "escape" special characters within a string. I'm not sure of the context of your first example, but that's what it looks like.

Dots are used to concatenate. Your second example seems incomplete, but it's probably concatenating a string with a variable and then another string. It might be better to provide context for both of those examples.

I think you would get a lot out of the PHP courses here on Treehouse :-)