Possible Duplicate:
What does the 'period' character (.) mean if used in the middle of a php string?
Why are the periods included in the code that follows?
require("mod/" . $modarrayout . "/bar.php");
Obviously, it's because the variable is between strings, but shouldn't the quotes have taken care of that? PHP
In PHP, the period is the concatenation operator. Putting the periods in tells PHP to concatenate "mod/"
to $modarrayout
and then concatenate the resulting string to "/bar.php"
. See page String Operators.
The following is the same in this case:
require("mod/$modarrayout/bar.php");
Using string concatenation is a different approach to string building.
I suggest reading the manual page on strings.
There are two string operators. The first is the concatenation operator ('.'), which returns the concatenation of its right and left arguments. The second is the concatenating assignment operator ('.='), which appends the argument on the right side to the argument on the left side.
Read: String Operators
精彩评论