As technology is advancing by leaps and bounds, so we can see constant updates in the various programming languages such as PHP, the most popular programming language adopted by most of the application developers.
On 28th August 2014, a new version of PHP was released and was immediately made available with some updated features, incompatible changes and much improved version.
So, let’s have a brief idea of its main features:
- Constant scalar expressions
- Variadic functions
- Exponentiation using ** operator
- Function & constant importing with use keyword
- An interactive integrated debugger PHPdbg
- A new re usable function PHP://
- GMP objects provide operator overloading
- Files more than 2 GB in size can now be uploaded
Now let’s look deeper into some of these features and how exactly they work:
- Constant Scalar Expressions: Now, we can provide scalar expressions with numeric and string literals or constants in contexts where a static value was displayed such as constant, property declarations and default function arguments.
Output will be:
The value of THREE is 3
- Variadic Functions: The most important feature is the implementation of variadic functions which now can be used with the help of …. Operator instead of using func_get_args().
Output will be:
$req: 1; $opt: 0; number of params: 0
$req: 1; $opt: 2; number of params: 0
$req: 1; $opt: 2; number of params: 1
$req: 1; $opt: 2; number of params: 2
$req: 1; $opt: 2; number of params: 3
- Exponentiation using ** operator: One of the easiest ways to use exponents is using **operator which is used to support exponentiation along with shorthand assignment operator “a”.
Let’s understand this with an example:
Output will be as follows:
2 ** 3 == 8
2 ** 3 ** 2 == 512
a == 8
- PHPdbg: Now this latest PHP version includes interactive debugger called PHPdbg which will be implemented as a SAPI module.
- Uploading large files becomes easy: A good news for those who had trouble especially regarding file upload in previous PHP versions, now with this PHP 5.6.0 . files upto 2 gb ( gigabytes) can be uploaded very easily.
Enjoy the journey of PHP and keep using latest versions to get better functionalities and it is well said that experts are always ahead from the usual crowd. So, make yourself an expert by trying different versions of this unique most popular programming language.
In case you feel that something is difficult to understand, then web developer for PHP framework at Softqube Technologies are here to help you.