Php integer division. How to do integer division in PHP

Programmers who need to perform sensitive numerical, scientific, or statistical calculations are unlikely to consider a web scripting language as an acceptable candidate for this role. But, despite the above, the PHP language offers an excellent set of functions that completely provide a solution to most mathematical problems, arising during the execution of scripts for the web. In addition, PHP provides some more advanced capabilities, such as arbitrary precision arithmetic, hashing libraries, and cryptographic libraries.

The developers of the PHP language took a well-founded approach and did not make any attempt to reinvent the wheels designed for this purpose. The fact is that many of the most fundamental mathematical functions used in PHP language, are simply wrappers around the C counterparts of these functions.

Mathematical operations

Majority mathematical operations in the PHP language it is carried out in the form of built-in functions, and not in the form of operations. In addition to comparison operations, the PHP language offers five simple operations arithmetic operations, as well as some shorthand operators that allow you to construct more concise expressions for increment, decrement, and assignment.

Arithmetic operations

The five basic arithmetic operations include those commonly implemented in any four-function calculator, plus modulo (%). Brief description arithmetic operations shown in the table:

Arithmetic operations
Operation Description
+ Returns the sum of the values ​​of its two operands
- If there are two operands, then the value of the right operand is subtracted from the value of the left one. If there is only a right-hand operand, then the operation returns the value of that operand with the opposite sign
* Returns the product of the values ​​of its two operands
/ Returns the floating point result of dividing the value of the left operand by the value of the right operand
% Returns the remainder of integer division the value of the left operand to absolute value right operand

When using the first three arithmetic operations described above (+, -, *) in a program, you should take into account that when performing these operations, type propagation occurs from double-precision floating-point values ​​to integer values. What this means is that if both operands of an operation are integers, then the result is an integer, and if at least one of the operands is a double-precision floating-point number, then the result is a double-precision floating-point number. The same type propagation occurs when performing a division operation; in addition, there is an additional effect that the result becomes a double-precision floating-point number if the division is not performed without a remainder (entirely).

The modulo (%) operation in PHP accepts integer operands, and when this operation is applied to double-precision floating-point numbers, then these numbers are first converted to integers (by discarding the fractional part). The result of such an operation is always an integer.

Increment and decrement operations

Much of PHP's syntax is derived from C, and C programmers are known for their love of brevity and take pride in it. The increment and decrement operators, taken from the C language, provide a more succinct representation of expressions like $count = $count + 1 , which are commonly encountered in programs.

The increment operator (++) is used to add one to the value of the variable affected by the operation, and the decrement operator (--) subtracts one from the value of that variable.

Each of these two operations has two varieties - suffix(in this form the operation sign is placed immediately after the variable affected by the operation) and prefix(in this form, the operation sign is placed immediately before the variable to which the operation applies). Both varieties have the same side effect associated with changing the value of a variable, but suffix and prefix operations return different meanings when used as expressions. The suffix operation operates so that the value of the variable is changed after the value of the expression is returned, and the prefix operation operates so that the value is first changed and then the new value is returned to the variable. This difference can be detected by using the decrement and increment operators in assignment operators:

PHP code $count = 0; $result = $count++; echo "Result of $count++ increment: ".$result."
"; $count = 0; $result = ++$count; echo "Result of ++$count increment: ".$result."
";

The following statements produce the following output in the browser window:

Increment operations

In this example, the operator $result = $count++ is completely equivalent to the operators:

PHP code $result = $count; $count = $count + 1;

Along with this, the operator $result = ++$count is equivalent to the following operators:

PHP code $count = $count +1; $result = $count;

Assignment Operators

Increment (and decrement) operators reduce the amount of code required to add one to the value of a variable, but do not reduce the amount of code that assigns a variable the result of adding its value to another number or the result of other arithmetic operations. Fortunately, all five arithmetic operators have corresponding assignment operators (+=, -=, *=, /=, and %=), which allow you to assign the result of an arithmetic operation on the value of that variable to a variable in one short expression. For example, the operator

PHP code $count = $count * 3;

can be abbreviated as

PHP code $count *= 3;

Simple Math Functions

The next step in making a program more complex than one that uses only arithmetic operations is to use all kinds of functions. Functions allow you to perform tasks such as converting from one numeric type to another (see the Data Types article) and finding the minimum or maximum number in many numbers. The following table shows simple mathematical functions:

Simple PHP Math Functions
Function Description
floor() Takes a single actual parameter (typically a double-precision floating-point number) and returns the largest integer that is less than or equal to that actual parameter (round down)
ceil() The name of this function is an abbreviation of the word ceiling. The function takes a single actual parameter (usually a double-precision floating-point number) and returns the smallest integer that is greater than or equal to that actual parameter (rounding up)
round() Takes a single actual parameter (typically a double-precision floating-point number) and returns the nearest integer
abs() Number module. If the only numeric actual parameter has a negative value, then the function returns the corresponding positive number; if the actual parameter is positive, then the function returns the actual parameter itself
min() Accepts any number of numeric actual parameters(but not less than one) and returns the smallest of all actual parameter values
max() Accepts any number of numeric actual parameters (but at least one) and returns the largest of all actual parameter values

For example, the result of the following expression is 3 because the value of each function call expression is also 3:

PHP code $result = min(3, abs(-3), max(round(2.7), ceil(2.3), floor(3.9)));

Generating random numbers

The PHP language uses two random number generators (called respectively using the functions rand() And mt_rand()). Each of these generators is associated with three functions of the same purpose: the function of setting the initial value ( srand() And mt_srand()), the function itself for obtaining a random number and the function that samples the largest integer that can be returned by the generator (( getrandmax() And mt_getrandmax())). The getrandmax() and mt_getrandmax() functions return a value the largest number, which can be returned by rand() or mt_rand(), on Windows platforms this value is limited to 32768.

Selecting a specific generation function pseudorandom numbers, which is used in the rand() function, may depend on which libraries the PHP interpreter was compiled with. In contrast, the mt_rand() generator always uses the same pseudo-random number generation function (mt is short for Mersenne Twister), and the author of the operational documentation for the mt_rand() function claims that this function is also faster and " more random" (from a cryptographic point of view) than rand(). We have no reason to doubt the truth of these statements, which is why we prefer to use the mt_rand() function rather than rand().

When using some versions of PHP on some platforms, it appears that the rand() and mt_rand() functions produce seemingly acceptable random numbers, even without first setting a seed. But such an impression should not be trusted. Firstly, programs that use functions for generating random numbers without specifying an initial value cannot be easily transferred to other platforms, and, secondly, the reliable operation of these functions without specifying an initial value is not guaranteed.

A typical way to set the initial value for any of the random generators PHP numbers(using the mt_srand() or srand() function) is as follows:

PHP code mt_srand((double)microtime()*1000000);

This statement sets the initial value of the generator, equal to the number of microseconds that have elapsed by this time since the last whole second was counted. (Type cast to type double in this statement is really necessary because the microtime() function returns a string, which is treated as an integer in the multiplication operation, but not in the operation of passing parameters to the function.) We recommend that the reader enter the specified initial value operator, even if he is not entirely clear about the purpose of this operator; just enough to place this operator for each PHP page, just once, before using the corresponding mt_rand() or rand() function, and this operator will ensure that the starting point changes and therefore produces different random sequences each time.

This particular method of setting the initial value was deeply thought out by those specialists who fully understand all the nuances of generating pseudo-random numbers, therefore, most likely, it will forever remain better than any attempts by any individual programmer to come up with something more “tricky”.

Obviously, these pseudo-random number generation functions only return integers, but a random integer from a given range can easily be converted to a corresponding floating-point number (say, a number from the range 0.0 to 1.0 inclusive) using an expression like rand() / getrandmax(). The specified range can then be scaled and shifted as needed. Below is an example:

PHP code // Let's say we need to generate random number from 100.0 to 120.0 $random = 100.0 + 20.0 * mt_rand() / mt_getrandmax(); echo $random."
"; // Generate integers (100 - 120); echo round($random);

Try refreshing the page with this code several times to ensure that random numbers are generated.

Mathematical constants

In PHP version 4.0, there was only one mathematical constant described in the documentation - M_PI (the value of π, represented as a double-precision floating-point number). And starting from PHP versions 4.0.2 many new constants were introduced. Most of these new constants related to π (or its multiples), e (or its multiples), and square roots; in addition, some constants belonged to other types. But in subsequent releases, for a number of reasons, the list of constants was again reduced to a relatively small number of predefined mathematical constants:

PHP Mathematical Constants
Constant Description
M_PI π
M_PI_2 π/2
M_PI_4 π/4
M_1_PI 1/π
M_2_PI 2/π
M_2_SQRTPI 2 / sqrt(π)
M_E e
M_SQRT2 sqrt(2)
M_SQRT1_2 1 / sqrt(2)
M_LOG2E log2(e)
M_LOG10E log(e)
M_LN2 loge(2)
M_LN10 loge(10)

Checking number format

The PHP language provides a number of functions that allow you to check the correct representation of numbers. Although PHP does not have strict type checking, it is recommended that you implement some of these checks in your code if necessary so that you can predict the characteristics of the results you receive and also choose best way their processing.

First and most simple check is to use the function is_numeric(). As with most other such tests, the is_numeric function returns a Boolean result - true if the parameter passed to it is numeric data of any type (signed or unsigned, integer or floating point) or a mathematical expression that returns a valid numeric value.

Using functions is_int() And is_float You can determine whether a number is an integer or a fraction. Two more checks are a little more complex: functions is_finite() And is_infinite() allow you to perform exactly the tests that their names indicate (whether the number is finite or infinite). But, strictly speaking, the range of values ​​over which these functions extend cannot include actual infinity (and can it even be checked whether the number has infinity? great value?). Instead, the limits of the range of floating point values ​​allowed on the particular system are used.

Below is an example of using these functions:

PHP code is_numeric(4); // true is_numeric(25 - 6); // true is_numeric("25"); // true is_numeric("25 - 6"); // false is_int(4); // true is_int(4.2); // false is_int("4"); // false - this check stricter than is_numeric() is_float(4); // false is_float(4.0); // true is_float(M_PI); // true

Conversion of number systems

By default, PHP uses base 10 to convert numeric values ​​from external to internal representation forward and backward. You can also tell the PHP interpreter that the external representation uses octal numbers, specified in base 8 (for this you must enter a leading 0 before the number), or hexadecimal numbers, specified in base 16 (for this, you must enter the prefix 0x before the number).

Of course, after converting numbers from an external representation to an internal one, they are stored in memory in binary format, and all basic arithmetic and mathematical calculations are carried out in the operating system in base 2. In addition, the PHP language provides a number of functions for converting numbers from one base of the number system to another. General information These functions are shown in the table below:

Number system conversion functions
Function Description
BinDec() Takes a single string parameter that is a binary integer (a base 2 number) and returns the base 10 string representation of that number
DecBin() Similar to BinDec(), but converts from base 10 to base 2
OctDec() Similar to BinDec(), but converts from base 8 to base 10
DecOct() Similar to BinDec(), but converts from base 10 to base 8
HexDec() Similar to BinDec(), but converts from base 16 to base 10
DecHex() Similar to BinDec(), but converts from base 10 to base 16
base_convert() Takes a string parameter (representing the integer to be converted) and two integer parameters (the original and the desired radix). Returns a string representing the converted number. In this line, numbers greater than 9 (10 to 35) are represented symbols a-z. Both the original and the desired bases must be within the range of 2-36

All number system conversion functions are functions special purpose, converting numbers from one specific base to another. An exception is the base_convert() function, which takes arbitrary parameters with the designation of the initial and resulting basis.

Note that all number system conversion functions accept string parameters and return string values, but you can use decimal numeric parameters and rely on the PHP interpreter to perform the type conversion correctly. In other words, both DecBin("1234") and DecBin(1234) both produce the same result.

Exponents and logarithms

The PHP language includes standard exponential and logarithmic functions in two varieties - for working in base 10 and base e (which are shown in the table).

PHP provides an exp() function to raise e to a given power, but there is no one-parameter function to raise 10 to a given power. However, you can use the pow() function instead, which takes two parameters, giving 10 as the first parameter.

You can verify that exponential and logarithmic functions with the same base are inverses of each other by checking the identity of the results obtained in this way:

PHP code $test_449 = 449.0; $test_449 = pow(10, exp(log(log10($test_449)))); echo "test_449 = $test_449"; // test_449 = 449

Trigonometric functions

The PHP language provides standard set basic trigonometric functions, general information about which is given in the table:

Trigonometric functions
Function Description
pi() It takes no parameters and returns an approximate value of π (3.1415926535898). Can be used interchangeably with the M_PI constant
sin() Accepts numeric parameter in radians and returns the sine of the parameter as a double precision floating point number
cos() Takes a numeric parameter in radians and returns the cosine of the parameter as a double precision floating point number
tan() Accepts a numeric parameter in radians and returns the tangent of the parameter as a double precision floating point number
asin() Takes a numeric parameter and returns the arcsine of the parameter in radians. Inputs must be between -1 and 1 (the function receiving inputs outside this range results in a NAN result). The results range from -π/2 to π/2
acos() Takes a numeric parameter and returns the arc cosine of the parameter in radians. Inputs must be in the range -1 to 1 (the function receiving inputs outside this range results in a NAN result. Results are in the range 0 to π
atan() Takes a numeric parameter and returns the arctangent of the parameter in radians. The results range from -π/2 to π/2

Below is an example of compiling a table for calculating trigonometric functions for “standard” angles:

PHP code function display_trigonometry($func_array, $input_array) ( // Function header echo " "; ) echo ""; // Print the rest of the table foreach($input_array as $input) ( echo " "; foreach($func_array as $func) ( echo " "; ) echo ""; ) echo "
Meaning/function$func
".sprintf("%.4f",$input).""; printf("%4.4f", $func($input)); echo "
"; ) display_trigonometry(array("sin", "cos", "tan"), array(0, M_PI / 6, M_PI / 3, M_PI / 2, M_PI));

An example of using trigonometric functions in PHP

Getting very large (but not infinite) tangent values ​​is because the denominators should theoretically be zero, but in reality are slightly different from zero due to rounding errors.

Arbitrary precision calculation (using BC functions)

Integer and double-precision floating-point types are perfectly adequate for most math problems encountered in web scripting, but each instance of the value represented by these types has a fixed storage capacity. computer memory, therefore, restrictions are inevitably imposed on the size and accuracy of representation of numbers of these types.

Of course, the exact value ranges of these data types may depend on the architecture server computer, but integer values ​​can typically range from -2 31 -1 to 2 31 -1, and double-precision floating-point numbers can represent numbers with a precision of about 13 to 14 decimal digits. On the other hand, to solve problems that require the use of a wider range of representation or greater precision, PHP provides arbitrary precision mathematical functions(also called BC functions, named after the Unix-based arbitrary precision computing utility).

It may be that arbitrary precision functions are not included in the compilation of the PHP interpreter, especially if the user did the compilation themselves, since for this the user would have to know that at the configuration stage it is necessary to include a checkbox in the parameters --enable-bcmath. To check whether the specified functions are available, try evaluating the expression bcadd("1","1"). If you receive an error message that says undefined function, then you will need to configure the configuration again and recompile the PHP interpreter.

BC functions do not use parameters or return values. numeric types with a fixed length representation rather than a string. Since in PHP the length of strings is limited only by the size available memory, the numbers used in the calculations can be of any length. Basic calculations are carried out in decimal and are in many ways reminiscent of those that a person can do with a pencil and paper (if he can act very quickly and be patient). BC integer functions are precise and allow you to use as many digits as needed, while floating-point functions perform calculations accurate to a specified number of decimal places. General information about BC functions is given in the table below:

Mathematical functions with arbitrary precision (BC functions)
Function Description
bcadd() Accepts two string parameters representing numbers and an optional integer parameter indicating a scale factor. Returns the sum of the first two parameters as a string, with the number of decimal places in the result determined by the parameter indicating the scale factor. If the parameter indicating the scale factor is not specified, then the default scale factor is used
bcsub() Similar to bcadd(), except that it returns the result of subtracting the second parameter from the first
bcmui() Similar to bcadd(), except that it returns the result of multiplying its parameters
bcdiv() Similar to bcadd(), except that it returns the result of dividing the first parameter by the second
bcmod() Returns the modulus (remainder) of dividing the first parameter by the second. Because the return value is an integer, the function does not accept a parameter indicating a scale factor
bcpow() Raises the first parameter to a power, indicated second parameter. The number of decimal places in the result is determined by the scale factor, if one is specified
bcsqrt() Returns square root parameter with a number of decimal places determined by the value of the optional scale factor
bcscale() Sets the default scale factor for subsequent calls to the BC function

Most of these functions take as last parameter an optional scale factor (integer) that specifies how many decimal places the result should have. If this parameter is not specified, the default scale factor is used as the scale factor, which in turn can be set by calling the bcscale() function. The default value for this default value (that is, the value that is used if the script does not call bcscale()) can also be set in the php.ini initialization file.

Below is an example of using an arbitrary precision function to perform integer arithmetic operations accurately. Executing the following code:

PHP code for ($x = 1; $x< 25; $x++) { echo "$x$x= ".bcpow($x, $x)."
"; }
Accurate calculation of astronomical quantities using BC functions

If a regular integer were used for these calculations PHP type, then the integer overflow would occur long before the end of the calculation, so the rest of the loop would perform calculations to obtain an approximate floating point number.

Arrays Form processing 1 2 3 4 5 6 7 8 9 10

Last update: 11/1/2015

In PHP we can use various operators: arithmetic, logical, etc. Let's look at each type of operation.

Arithmetic operations

    + (addition operation)

    For example, $a + 5

    - (subtraction operation)

    For example, $a - 5

    * (multiplication)

    For example, $a * 5

    / (division)

    For example, $a / 5

    % (obtaining the remainder of division)

    For example: $a=12; echo $a % 5; // equals 2

    ++ (increment/increase value by one)

    For example, ++$a

    It is important to understand the difference between the expressions ++$a and $a++ . For example:

    $a=12; $b=++$a; // $b is equal to 13 echo $b;

    Here, first, one is added to the value of the variable $a, and then its value is equated to the variable $b. It would be different if the expression looked like this: $b=$a++; . Here, first the value of the variable $a was equal to the variable $b, and then the value of the variable $a was increased.

    -- (decrement/decrease value by one)

    For example, --$a . And also, as in the case of increment, there are two types of recording: --$a and $a--

Assignment Operators

    Equates a variable to a specific value: $a = 5

    Addition followed by assignment of the result. For example: $a=12; $a += 5; echo $a; // equal to 17

    Subtraction followed by assignment of the result. For example: $a=12; $a -= 5; echo $a; // equals 7

    Multiplication followed by assignment of the result: $a=12; $a *= 5; echo $a; // equals 60

    Division followed by assignment of the result: $a=12; $a /= 5; echo $a; // equal to 2.4

    Concatenate rows and assign the result. Applies to two lines. If the variables do not store strings, but, for example, numbers, then their values ​​are converted to strings and then the operation is performed: $a=12; $a .= 5; echo $a; // equal to 125 // identical to $b="12"; $b .="5"; // equal to 125

    Obtaining the remainder of division and then assigning the result: $a=12; $a %= 5; echo $a; // equals 2

Comparison Operations

Comparison operations are usually used in conditional constructions when it is necessary to compare two values ​​and, depending on the result of the comparison, perform certain actions. The following comparison operations are available.

    The equality operator compares two values, and if they are equal, returns true, otherwise returns false: $a == 5

    The identity operator also compares two values, and if they are equal, returns true, otherwise returns false: $a === 5

    Compares two values, and if they are not equal, returns true, otherwise returns false: $a != 5

    Compares two values, and if they are not equal, returns true, otherwise returns false: $a !== 5

    Compares two values, and if the first is greater than the second, then returns true, otherwise returns false: $a > 5

    Compares two values, and if the first is less than the second, then returns true, otherwise returns false: $a< 5

    Compares two values, and if the first is greater than or equal to the second, then returns true, otherwise returns false: $a >= 5

    Compares two values, and if the first is less than or equal to the second, then returns true, otherwise returns false: $a<= 5

Equality and identity operator

Both operators compare two expressions and return true if the expressions are equal. But there are differences between them. If the equality operation takes two values ​​of different types, then they are reduced to one - the one that the interpreter finds optimal. For example:

Obviously, variables store different values ​​of different types. But when compared, they will be reduced to the same type - numeric. And the variable $a will be reduced to the number 22. And in the end, both variables will be equal.

Or, for example, the following variables will also be equal:

$a = false; $b = 0;

To avoid such situations, the equivalence operation is used, which takes into account not only the value, but also the type of the variable:

$a = "22a"; $b = 22; if($a===$b) echo "equal"; else echo "not equal";

Now the variables will not be equal.

The inequality operators != and !== work similarly.

Logical operations

Logical operations are typically used to combine the results of two comparison operations. For example, we need to perform a certain action if several conditions are true. The following logical operations are available:

    Returns true if both comparison operations return true, otherwise returns false: $a == 5 && $b = 6

    Similar to the && operation: $a == 5 and $b > 6

    Returns true if at least one comparison operation returns true, otherwise returns false: $a == 5 || $b = 6

    Similar to the operation || : $a< 5 or $b > 6

    Returns true if the comparison operation returns false: !($a >= 5)

    Returns true if only one of the values ​​is true. If both are true or neither is true, returns false. For example: $a=12; $b=6; if($a xor $b) echo "true"; else echo "false";

    Here the result of the logical operation will be false since both variables have a specific value. Let's change the code:

    $a=12; $b=NULL; if($a xor $b) echo "true"; else echo "false";

    Here the result will already be true, since the value of one variable is not set. If a variable has the value NULL, then in logical operations its value will be treated as false

Bit operations

Bit operations are performed on individual bits of a number. Numbers are considered in binary representation, for example, 2 in binary representation is 010, the number 7 is 111.

    & (logical multiplication)

    Multiplication is performed bitwise, and if both operands have bit values ​​equal to 1, then the operation returns 1, otherwise the number 0 is returned. For example: $a1 = 4; //100 $b1 = 5; //101 echo $a1 & $b1; // equals 4

    Here the number 4 in the binary system is equal to 100, and the number 5 is equal to 101. Multiply the numbers bitwise and get (1*1, 0*0, 0 *1) = 100, that is, the number 4 in decimal format.

    | (logical addition)

    Similar to logical multiplication, the operation is also performed on binary digits, but now one is returned if at least one number in a given digit has a one. For example: $a1 = 4; //100 $b1 = 5; //101 echo $a1 | $b1; // equals 5

    ~ (logical negation)

    inverts all bits: if the bit value is 1, then it becomes zero, and vice versa. $b = 5; echo ~$b;

    x<

    x>>y - shifts the number x to the right by y digits. For example, 16>>1 shifts the number 16 (which is 10000 in binary) one place to the right, so the result is 1000 or the number 8 in decimal

Concatenating Strings

The dot operator is used to concatenate strings. For example, let's connect several lines:

$a="Hello,"; $b=" world"; echo $a . $b . "!";

If the variables represent other types than strings, such as numbers, then their values ​​are converted to strings and then the string concatenation operation also occurs.

Logical operations exist in all programming languages ​​and PHP no exception. In addition to simple division, multiplication, addition or subtraction, there are also integer and remainder divisions, which we will now talk about and also analyze them using detailed examples.

Integer division is the output of the integer part from the division. For example, if we divide 5 by 2, we get 2, not 2.5.

With residual division everything is different. This is the output of the remainder when divided by an integer. For example, dividing the same five, you will get not 2, but 1, because dividing 5 by 2, we get 2, and the remainder is 1.

How to do integer division in PHP

For example, in Python this division is done using a simple operator: "//".

And in PHP this will not be so easy to do, but still the process does not require super knowledge of the language.

Let's give an example of how this can be implemented.

IN PHP The seventh version of the function looks like this:

Intdiv();

In an older version, the same function looks like this:

There is also a method for all versions:

Floor();

How to apply?

For example, let's take the first function, all the others are performed in approximately the same way.

$result = intdiv(10, 3); echo $result;

Remainder division in PHP

To display the integer remainder of division in PHP It's enough to just use the "%" operator.

$i = 10% 3; echo $i;

As we can see, everything is quite simple and does not require lengthy explanations.

Where can it be used?

Knowledge of integer division PHP will be very useful if you need to compare two numbers, create an inverted number (a popular exercise), or, for example, a program called FizzBuzz. Its essence is that you have to write a cycle from 1 to 100, which divides each number by 3 and 5. If the number divided by 3 has a remainder of 0, then we write Fizz, if divided by 5, then Buzz, and if , dividing both 5 and 3, the remainder is 0, then we write FizzBuzz. This is a very popular interview task. If you completed it yourself, you can be proud of yourself.

Or, for example, we have to derive all its numbers (4, 5, 2) from the number 452.

Conclusion

Of course, integer and remainder divisions are useful and quite common; they are not as convenient to use as in Python, but they are still important.

Now you are one step closer to learning a programming language PHP and in the future you will become even closer if you overcome difficulties just as diligently.