Revisiting PHP Part VII: PHP7 Integer Division function & Anonymous Classes in PHP7

Making division with integers had not been easy with previous versions of PHP which has usually done with “/” slash symbol. However, with PHP 7, typecasting has brought a new method of getting the job done. The name of the function is: intdiv() and it efficiently brought in for this reason by taking dual values. For instance, the numerator and denominator brings back a certain quotient which is actually a number. A typical instance is given below:

<?php

echo intdiv(45, 5), PHP_EOL; # outputs: 9

?>

First look at the Anonymous Classes in PHP7

Finally, PHP7 dawns a modern method to make objects or classes with actually naming them. These specific classes or objects can be “disconnected”-(unset) at any time. This feature is quite unique and makes creation of classes easier. The following is a typical example.

<?php

$handsonlabs_sa= new class(“Innovations_&_Solutions”){

public function __construct($problem_solving){

echo ‘Welcome to, ‘ . $ problem_solving . ‘!’ . PHP_EOL;

}

};

?>

//outputs Welcome to, Innovations_&_Solutions!