moodLearning Wiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
php-upgrade-cheatsheet [2018/01/02 04:15]
serbizadmin
php-upgrade-cheatsheet [2020/06/13 15:10] (current)
Line 1: Line 1:
 ====== Cheatsheet for Upgrading PHP Sites ====== ====== Cheatsheet for Upgrading PHP Sites ======
-The change that recently rocked the dev world was the sunsetting of PHP 5.x and moving PHP to version 7. Not that many organizations are prepared to do just that. So we have prepared a cheatsheet to cover some important technical changes and make it easier to people to transition to the new PHP  version.+The change that recently rocked the dev world was the sunsetting of PHP 5.x and moving PHP to version 7. (Don't ask us where version 6 is.) Also in the horizon is [[https://secure.php.net/supported-versions.php|the trasition to newer releases of version 7]]. 
 +\\ 
 +\\ 
 +Not that many organizations are prepared to deal with the change. So the [[https://moodlearning.com|moodLearning]] team has prepared a cheatsheet to cover some important technical changes to make it easier for people to transition to the new PHP  version. 
 +\\ 
 +\\ 
 +{{ ::php_upgrade_cheatsheet.jpg?600 |}} 
 ===== PHP 5.x to 7 ===== ===== PHP 5.x to 7 =====
 +==== Deprecated Functions in php5 ====
 +
 +
 +**Sample**
 +
 +<code><?php
 + 
 +class Sample {
 + 
 +   function Sample() {
 + 
 +       echo 'Hello World';
 + 
 +   }
 + 
 +}
 +?></code>
 +
 +**Fix for php7**
 +
 +If your class has a constructor having the same name as your class name, then it is now deprecated in PHP 7. Change constructor to <nowiki>__construct</nowiki>
 +
 +Sample
 +
 +<code><?php
 + 
 +class Sample{
 + 
 +   function __construct() {
 + 
 +       echo 'Hello World!';
 + 
 +   }
 + 
 +}
 + 
 +?></code>
 +\\
 +\\
 +
 +----
  
 ===== See Also===== ===== See Also=====
   * [[http://php.net/manual/en/migration70.changed-functions.php|Changed PHP Core Functions]]   * [[http://php.net/manual/en/migration70.changed-functions.php|Changed PHP Core Functions]]