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.

php

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…

What advantages for a company in adopting a low-code tool?

Let's understand how low-code tools have become a facilitator in the web development process as they...

How to implement A2F using Swivel in a Scriptcase application

I want to start talking about Swivel, Swivel is a provider of authentication solutions who have been...

Comments, tips and interactions inside Scriptcase.

Hello, here are some tips, comments and interactions about database and tools like HTML, CSS, JavaSc...

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 sales@scriptcase.net. Learn more about our Privacy Police.