why are there periods in php [duplicate]

2019-06-26 01:06发布

Possible Duplicate:
What does the 'period' character (.) mean if used in the middle of a php string?

as the title says, why are the periods? such as

require("mod/".$modarrayout."/bar.php"); 

obviously its because the variable is between strings, but shouldnt the quotes have taken care of that? Just want to know to clarify further coding

3条回答
We Are One
2楼-- · 2019-06-26 01:37

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.

查看更多
太酷不给撩
3楼-- · 2019-06-26 01:40

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: http://php.net/manual/en/language.operators.string.php

查看更多
ゆ 、 Hurt°
4楼-- · 2019-06-26 01:51

In PHP, the period is the concatentation operator. Putting the periods in tells PHP to concatenate "mod/" to $modarrayout and then concatenate the resulting string to "/bar.php". See this page:

http://www.php.net/manual/en/language.operators.string.php

查看更多
登录 后发表回答