Alfraganus Posted August 6, 2015 Share Posted August 6, 2015 dear bros, why we have to use "." (DOT) before and after every variable? for example: $color="green"; echo "my eyes' color is ".$color."; thank you for your attention. Link to comment Share on other sites More sharing options...
Don E Posted August 6, 2015 Share Posted August 6, 2015 (edited) In PHP, the dot is the concatenation operator. See this link: http://www.w3schools.com/php/php_operators.asp ...scroll down to String Operators. If you don't want to use the dot operator to concatenate, you can use double quotes with the variable included like the following: echo "My eye color is $color"; Because of being in double quotes, PHP displays(parses) the value of the variable $color. The output is: My eye color is green. Edited August 6, 2015 by Don E Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now