Here we will see some of the functions listed below that are removed in PHP7.
1- ASP-style tags ( <%, <%= and %> ), is removed.
2- Script tags "<"script language='php' ">" Note: always use "<"?php ?">".
3-Split function that returns an array of strings after splitting up a string is removed.
4-The ereg extension with all it's ereg_* functions have been deprecated since PHP 5.3
and replaced by PCRE extention.
5- Mysql extention is depricated since 5.5 and hence removed in php7
6-Uniform Variable Syntax
class A
{
public $username = 'abcd';
public $job_type = 'Technical';
}
$xyz = new A();
$attributes = ['1' => 'username', '2' => 'job_type'];
echo "\n User name is " . $xyz->$attributes['1'] . "<br>";
echo "\n User Job Type is " . $xyz->$attributes['2'] . "\n\n";
OUTPUT:
User name is abcd
User Job Type is Technical
In PHP 5, the expression $xyz->$attribute['1'] is evaluated as $xyz->{$attribute['1']}
In PHP 7, the expression $xyz->$attribute['1'] is evaluated as {$xyz->$attribute}['1']
$xyz->{$attribute['1']} gives the same output in PHP 5 and PHP 7
7-Fatal Error with multiple default clauses
switch ($expression) {
default:
notExecuted();
break;
default:
executed();
}
In PHP 5, the last default would be used in switch.
But in PHP 7, switch statements will contain only one default else we will get a Fatal Error in case of PHP7.
0 Comment(s)