Some elements are essential for developing any type of application, among these elements mathematical operators and functions related to string some of these elements are essential, without them it would be impossible to perform any kind of processing. Therefore it is important to understand how they are declared and how they are worked in programming.

In PHP the arithmetic operators are worked very simply, using the signals already known patterns is easier assimilates them and implement them accordingly.

Check out the examples below to arithmetic operators in PHP:

$var = 2 +2 / / Addition

$var = 2-2 / / Subtraction

$var = 2/2 / / Division

$var = 2 * 2 / / Multiplication

The variable $var assumed the operation result according to the calculation.

You can also use the calculations with variables that take a value at the beginning of the implementation, as shown below:

$var2 = 2;

$var = $var2 +2 / / Addition

$var = $var2 -2 / / Subtraction

$var = $var2 / 2 / / Division

$var = $var2 * 2 / / Multiplication

Another element widely used in PHP are the strings, this type of data is represented by any textual content.

$var = “Text 1”;

$var2 = “text 2”;

One of the most common operators in string is the concatenation, it is possible to join two strings in the same variable, as in the example below:

$var = “Text 1”;

$var2 = “text 2”;

$var3 = $ var. “”. $var2;

The variable $var3 assumed then the value “Text1 Text2”.

These basic operators are part of everyday life for all programmers who work with the PHP language and more than that, are essential in any type of activity.


If you are taking your first steps in the development of PHP applications count on one of the development tools that are market benchmark, Scriptcase. Go to the download page, download the free version now and start right now to enjoy all the benefits that only Scriptcase offers.

You might also like…

Scriptcase uses the MVC template?

Maybe you might have thought about this at some point, “Scriptcase uses the MVC templates?" Well, ...

How to implement A2F using Own Development in NodeJS in a Scriptcase application

A2F using Own Development in NodeJS A2F: In a previous article, we talked about Swivel as an extern...

Specialists or generalists, who gets a better advantage by using Scriptcase?

Hey there! Today  we will figure what are the ideal profiles for those who wish to take advantage o...

Comment this post

Get new posts, resources, offers and more each week.

We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at Learn more about our Privacy Police.