What expect from PHP 7

| Last Updated: | In: Core php, php7


What expect from PHP 7

PHP 7 is a major release of PHP programming language, It was released on December 2015. you can also read what is PHP ? Here are two great infographics that explain PHP 7 perfectly, take a look at PHP 7 Performance and 5 Things to Know about PHP 7.

Download PHP 7

PHP7

Scalar type declarations

Following types for parameters are enforced (either coercively or strictly): strings (string), integers (int), floating-point numbers (float), and booleans (bool) in PHP 7 now.
Exapmle :

Above example will output: int(9)

Return type declarations

PHP 7 adds support for return type declarations. Similarly to argument type declarations, return type declarations specify the type of the value that will be returned from a function.

Null coalescing operator

Session in PHP 7

Now session_start() function accepts an array as parameter which will override the session configuration directives which is in php.ini.

Spaceship operator

The spaceship operator is used for comparing two expressions. It returns -1, 0.

Define arrays type Constant

In PHP 7 you can define constant as array type using define() function. following is example of
Array type constant :

Anonymous class in PHP 7

PHP 7 support anonymous classes using new class. It can be used in place of full definitions of class for objects. Following is best example for this :

New functions In PHP 7

  • Closure::call()
  • random_bytes()
  • random_int()
  • error_clear_last()
  • Generator::getReturn()
  • gmp_random_seed()
  • intdiv()
  • preg_replace_callback_array()
  • gc_mem_caches()
  • get_resources()
  • posix_setrlimit()
  • ReflectionParameter::getType()
  • ReflectionParameter::hasType()
  • ReflectionFunctionAbstract::getReturnType()
  • ZipArchive::setCompressionIndex()
  • ZipArchive::setCompressionName()

New Global Constants

  • PHP_INT_MIN
  • LIBXML_BIGLINES
  • PREG_JIT_STACKLIMIT_ERROR
  • POSIX_RLIMIT_AS
  • POSIX_RLIMIT_CORE
  • POSIX_RLIMIT_CPU
  • POSIX_RLIMIT_DATA
  • POSIX_RLIMIT_FSIZE
  • POSIX_RLIMIT_LOCKS
  • POSIX_RLIMIT_MEMLOCK
  • POSIX_RLIMIT_MSGQUEUE
  • POSIX_RLIMIT_NICE
  • POSIX_RLIMIT_NICE
  • POSIX_RLIMIT_NOFILE
  • POSIX_RLIMIT_NPROC
  • POSIX_RLIMIT_RSS
  • POSIX_RLIMIT_RTPRIO
  • POSIX_RLIMIT_RTTIME
  • POSIX_RLIMIT_SIGPENDING
  • POSIX_RLIMIT_STACK
  • POSIX_RLIMIT_INFINITY

Reference from http://php.net/

Thank you for giving time on freewebmentor community. Please don’t forget to subscribe our newsletter or join us on Facebook to be the first to learn the next great thing from freewebmentor.

Tags: , , ,


About: Prem Tiwari

Prem Tiwari is founder of freewebmentor.com and Software developer from New Delhi (India). Follow Prem's development codes on facebook, and make sure you check out freewebmentor.com for the latest in web development related Tips with the complete code.


You may also like:

Follow us!

Get Free Access of 350+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Learn how to implement security guideline in your WordPress site...

DOWNLOAD

Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...

SEARCH NOW