'Why are there periods in PHP? [duplicate]
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
Solution 1:[1]
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.
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lightness Races in Orbit |
| Solution 2 | Peter Mortensen |
