Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 233
Tom Avatar asked May 28 '11 01:05

Tom


People also ask

What is the purpose of period in PHP?

This operator is used to combine strings. Well, to be more specific if a value is not a string, it has to be converted to one.

What does dot equal mean in PHP?

It's the concatenating assignment operator. It works similarly to: $var = $var .

What is interpolation PHP?

Variable interpolation is adding variables in between when specifying a string literal. PHP will parse the interpolated variables and replace the variable with its value while processing the string literal.

What kind of PHP variables store a single value?

Null is a special data type which can have only one value: NULL. A variable of data type NULL is a variable that has no value assigned to it.

What is the dateperiod class in PHP?

The DatePeriod class. (PHP 5 >= 5.3.0, PHP 7) Represents a date period. A date period allows iteration over a set of dates and times, recurring at regular intervals, over a given period.

Why do women have periods?

So, why do women have periods? As a woman, your period is your body’s way of releasing tissue that it no longer needs. Every month, your body prepares for pregnancy.

What is the introduction of a date period in SQL?

Introduction Represents a date period. A date period allows iteration over a set of dates and times, recurring at regular intervals, over a given period. Exclude start date, used in DatePeriod::__construct(). The number of recurrences, if the DatePeriod instance had been created by explicitly passing $recurrences.

What is a period and why does it matter?

Why? A period (menstruation) is normal vaginal bleeding that is a natural part of a healthy monthly cycle for a person with a uterus and ovaries. Every month, in the years between puberty (typically age 11 to 14) and menopause (typically about age 51), your body readies itself for pregnancy.


2 Answers

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.

like image 152
David Grayson Avatar answered Nov 15 '22 05:11

David Grayson


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.

like image 38
Lightness Races in Orbit Avatar answered Nov 15 '22 07:11

Lightness Races in Orbit