New functions in PHP7


  • The GMP module has added the gmp_random_seed() function.
  • PCRE adds the preg_replace_callback_array method. RFC: https://wiki.php.net/rfc/preg_replace_callback_array
  • Added intdiv() function.
  • Added error_clear_last() function to reset error status.
  • Added ZipArchive::setComapressionIndex() and ZipArchive::setCompressionName() to set the compression method.
  • Added deflate_init(), deflate_add(), inflate_init(), inflate_add().


PHP intdiv() function

PHP 7 has added the intdiv() function , receives two parameters, and returns the value of the first parameter divided by the second parameter and rounded.

Example

<?php
echo intdiv(9,3),PHP_EOL;
echo intdiv(10,3),PHP_EOL;
echo intdiv(5,10),PHP_EOL;
?>

The execution output of the above program is:

3
3
0