## 7.0.x 版本開始停用的特性
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Deprecated.md#php4-風格的構造函數)PHP4 風格的構造函數
在 PHP4 中類中的函數可以與類名同名,這一特性在 PHP7 中被廢棄,同時會發出一個 E_DEPRECATED 錯誤。當方法名與類名相同,且類不在命名空間中,同時PHP5的構造函數(__construct)不存在時,會產生一個 E_DEPRECATED 錯誤。
~~~
<?php
class foo {
function foo() {
echo 'I am the constructor';
}
}
?>
~~~
上述代碼輸出:
~~~
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in example.php on line 3
~~~
### [](https://github.com/pangee/Migrating-from-PHP5.6.x-to-PHP7.0.x/blob/master/Deprecated.md#password_hash-隨機因子選項)password_hash() 隨機因子選項
函數原 salt 量不再需要由開發者提供了。函數內部默認帶有 salt 能力,無需開發者提供 salt 值。