Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

New Features in PHP 7

 PHP 7 is a major release of PHP programming language and is touted to be a revolution in the way web applications can be developed and delivered for mobile to enterprises and the cloud. This release is considered to be the most important change for PHP after the release of PHP 5 in 2004.

There are some of features added to PHP 7, the most significant ones are mentioned below −

  1. Lower Memory Consumption − Optimized PHP 7 utilizes lesser resource.
  2. Improved performance − Having PHPNG code merged in PHP7, it is twice as fast as PHP 5.
  3. Consistent 64-bit support − Consistent support for 64-bit architecture machines.
  4. Improved Exception hierarchy − Exception hierarchy is improved.
  5. Scalar type declarations − Now parameter and return types can be enforced. 
  6. Many fatal errors converted to Exceptions − Range of exceptions is increased covering many fatal error converted as exceptions.
  7. Secure random number generator − Addition of new secure random number generator API.
  8. Deprecated SAPIs and extensions removed − Various old and unsupported SAPIs and extensions are removed from the latest version.
  9. The null coalescing operator (??) − New null coalescing operator added.
  10. Return Type Declarations − Support for return type and parameter type added.
  11. Anonymous Classes − Support for anonymous added.
  12. Zero cost asserts − Support for zero cost assert added.

PHP 7 uses new Zend Engine 3.0 to improve application performance almost twice and 50% better memory consumption than PHP 5.6. It allows to serve more concurrent users without requiring any additional hardware.

Difference between array_merge and array_combine in php


Function array_merge() merges the elements of one or more than one array such that the value of one array appended at the end of first array. If the arrays have same strings key then the later value overrides the previous value for that key.

<?php $array1 = array(“course1” => “java”,”course2″ => “sql”);
$array2 = array(“course1” => “php”,”course3″ => “html”);
$result= array_merge($array1, $array2);
print_r($result); ?>

Result
Array
(
[course1] => php
[course2] => sql
[course3] => html
)


Function array_combine() is used to creates a new array by using the key of one array as keys and using the value of other array as values. One thing to keep in mind while using array_combine() that number of values in both arrays must be same.

<?php $array1 = array(“course1″,”course2″,”course3”);
$array2 = array(“php”,”html”,”css”);
$result = array_combine($array1, $array2);
print_r($result); ?>

Result
Array
(
[course1] => php
[course2] => html
[course3] => css
)

If you have any query or suggestions, feel free to ask me via the comment section below.

must watch some other topics :

cake PHP training institute
cake PHP training course
cake php training online

Post a Comment

0 Comments