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.

By ,

July 19, 2013


You might also like…

5 reasons you can’t miss a Black Friday Scriptcase!

This November we bring you the biggest and most important discounts of the year! And do you know wh...

Taking a look at Scriptcase version 9.7

After the big Scriptcase 9.7 presentation event, we have a new version of Scriptcase for download, ...

October Newsletter

Follow the latest news for the month of October! Webinars, blog posts, videos, and more. WEB...

You might also like…

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.