{"id":274,"date":"2011-01-21T14:34:11","date_gmt":"2011-01-21T13:34:11","guid":{"rendered":"http:\/\/www.badral.net\/?p=274"},"modified":"2012-03-05T06:06:44","modified_gmt":"2012-03-05T05:06:44","slug":"is-it-time-to-upgrade-my-php-source-code-to-5-x","status":"publish","type":"post","link":"https:\/\/www.badral.net\/?p=274","title":{"rendered":"Is it time to upgrade my php source code to 5.x?"},"content":{"rendered":"<p>\u0417\u0430 \u0411\u043e\u043b\u043e\u0440 \u0410\u0423\u0421-\u044d\u044d \u0430\u043d\u0445 PHP 4.1- \u0434\u044d\u044d\u0440 \u0445\u04e9\u0433\u0436\u04af\u04af\u043b\u0436 \u044d\u0445\u044d\u043b\u0436\u044d\u044d. \u0413\u044d\u0442\u044d\u043b \u04e9\u043d\u04e9\u04e9\u0434\u04e9\u0440 \u043c\u0430\u0448 \u043e\u043b\u043e\u043d \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u044d\u044d\u0440 5.x \u044f\u0432\u0436 \u0431\u0430\u0439\u0434\u0430\u0433. \u041a\u043e\u0434 \u043c\u0430\u0430\u043d\u044c \u0445\u044d\u0434\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0430\u043d\u0434\u0430\u043b\u0442\u0430\u0442 \u0431\u043e\u043b\u043e\u0432\u0447 \u043d\u04e9\u0433\u04e9\u04e9 \u043b 4.x-\u0442\u044d\u0439\u0433\u044d\u044d \u0437\u043e\u0445\u0438\u0446\u043e\u0436 \u0430\u0436\u0438\u043b\u043b\u0430\u0436 \u0431\u0430\u0439\u0445\u044b\u043d \u0442\u0443\u043b\u0434 \u0445\u0443\u0443\u0447\u0438\u043d \u0437\u0430\u0433\u0432\u0430\u0440\u0430\u0430 \u0431\u0430\u0440\u044c\u0441\u0430\u0430\u0440 \u043b \u0431\u0430\u0439\u0434\u0430\u0433. \u0413\u044d\u0442\u044d\u043b \u0441\u04af\u04af\u043b\u0438\u0439\u043d \u04af\u0435\u0434 \u0448\u0443\u0443\u0434 PHP 5.3 \u0431\u043e\u043b\u043e\u043d \u0442\u04af\u04af\u043d\u044d\u044d\u0441 \u0445\u043e\u0439\u0448\u0445\u0438 \u0445\u0443\u0432\u0438\u043b\u0431\u0430\u0440\u0442 \u0437\u043e\u0440\u0438\u0443\u043b\u0430\u0430\u0434 \u0448\u0438\u043d\u044d\u0447\u043b\u044d\u043b\u0442 \u0445\u0438\u0439\u0447\u0438\u0445\u043c\u044d\u044d\u0440 \u0441\u0430\u043d\u0430\u0433\u0434\u0430\u0445 \u0431\u043e\u043b\u043e\u0432\u0447 \u0431\u0430\u0441 \u043c\u0430\u0448 \u043e\u043b\u043e\u043d\/\u0438\u0445\u044d\u043d\u0445\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u044d\u044d\u0440 PHP 4.x \u0430\u0436\u0438\u043b\u043b\u0430\u0441\u0430\u0430\u0440 \u0431\u0430\u0439\u0434\u0430\u0433. \u042d\u043d\u044d \u0442\u0430\u043b\u0430\u0430\u0440 \u0442\u0430 \u0431\u04af\u0445\u044d\u043d\u0434 \u0445\u0438\u0439\u0441\u044d\u043d \u0441\u0443\u0434\u0430\u043b\u0433\u0430\u0430 \u0431\u0430\u0439\u043d\u0430 \u0443\u0443? \u0422\u0430 \u0430\u043b\u044c \u0445\u0443\u0432\u0438\u043b\u0431\u0430\u0440\u044b\u0433 \u043d\u044c \u0445\u044d\u0440\u044d\u0433\u043b\u044d\u0436 \u0431\u0430\u0439\u043d\u0430?<br \/>\n\u041e\u0434\u043e\u043e \u0431\u0430\u0439\u0433\u0430\u0430 \u043d\u044d\u0433\u044d\u043d \u043c\u043e\u0434\u0443\u043b\u0438\u0439\u043d\u0445\u0430\u0430 \u0445\u044d\u0440 \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0430\u043d\u0434\u0430\u043b\u0442 \u0445\u0438\u0439\u0436 \u0431\u0430\u0439\u0433\u0430\u0430\u0433 \u04af\u0437\u04af\u04af\u043b\u0431\u044d\u043b:<\/p>\n<blockquote><p>require_once BASE_DIR . &#8216;module\/basemodule\/ListModule.php&#8217;;<br \/>\nclass Index extends ListModule {<br \/>\nvar $modHandler;<br \/>\nvar $someclassglob;<br \/>\nvar $staticvar;<br \/>\nfunction Index($db) {<br \/>\n\t\tparent :: ListModule($db, &#8216;category&#8217;);<br \/>\n\t\t$this->catHandler = new CategoryModHandler($db, $this->user->getLogin());<br \/>\n\t\t$this->start();<br \/>\n\t}<br \/>\n&#8230;..<br \/>\n&#8230;..<br \/>\nfunction xxxxx() {<br \/>\n&#8230;..<br \/>\n}<br \/>\n&#8230;..<br \/>\n}<br \/>\n$db = new MySQL($host, $dbUser, $dbPass, $dbName);<br \/>\n\/\/ Instantiate the Auth class<br \/>\n$auth = new Auth($db, SECRET);<br \/>\n\/\/ For logging out<br \/>\nif (isset ($_GET[&#8216;action&#8217;]) &#038;&#038; $_GET[&#8216;action&#8217;] == &#8216;logout&#8217;) {<br \/>\n\t$auth->logout();<br \/>\n}<br \/>\n$index = new Index($db);<br \/>\n&#8230;..<\/p><\/blockquote>\n<p>\u042d\u043d\u044d \u043d\u044c 4-\u0441 \u044d\u0445\u043b\u044d\u044d\u0434 \u04e9\u043d\u04e9\u04e9\u0433 \u0445\u04af\u0440\u0442\u044d\u043b \u0431\u04af\u0445 \u0445\u0443\u0432\u0438\u043b\u0431\u0430\u0440 \u0434\u044d\u044d\u0440 \u0430\u0436\u0438\u043b\u043b\u0430\u043d\u0430. \u0425\u04e9\u04e9\u0440\u0445\u0438\u0439 4.x-\u043d \u0445\u0438\u0439\u0436 \u0431\u0430\u0439\u0433\u0430\u0430 \u043b \u0431\u043e\u043b\u043e\u043c\u0436 \u043d\u044c \u044d\u043d\u044d. \u0423\u0433 \u043d\u044c \u0436\u0438\u043d\u0445\u044d\u043d\u044d \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0430\u043d\u0434\u0430\u043b\u0442\u0430\u0442 \u0431\u04e9\u0433\u04e9\u04e9\u0434 \u0430\u0440\u0430\u0439 \u043d\u0430\u0439\u0434\u0432\u0430\u0440\u0442\u0430\u0439 \u0431\u043e\u043b\u0433\u043e\u0451 \u0433\u044d\u0432\u044d\u043b:<\/p>\n<blockquote><p>require_once BASE_DIR . &#8216;module\/basemodule\/ListModule.php&#8217;;<br \/>\nclass Index extends ListModule {<br \/>\nprivate $modHandler;<br \/>\nprotected $someclassglob;<br \/>\nprivate static $somestaticvar;<br \/>\npublic function __construct($db) {<br \/>\n\t\tparent :: __construct($db, &#8216;category&#8217;);<br \/>\n\t\t$this->catHandler = new CategoryModHandler($db, $this->user->getLogin());<br \/>\n\t\t$this->start();<br \/>\n\t}<br \/>\n&#8230;..<br \/>\n&#8230;..<br \/>\nprivate function xxxxx() {<br \/>\n&#8230;..<br \/>\n}<br \/>\n&#8230;..<br \/>\n}<br \/>\n try {<br \/>\n $db = new MySQL($host, $dbUser, $dbPass, $dbName);<br \/>\n\/\/ Instantiate the Auth class<br \/>\n$auth = new Auth($db, SECRET);<br \/>\n\/\/ For logging out<br \/>\nif (isset ($_GET[&#8216;action&#8217;]) &#038;&#038; $_GET[&#8216;action&#8217;] == &#8216;logout&#8217;) {<br \/>\n\t$auth->logout();<br \/>\n}<br \/>\n$index = new Index($db);<br \/>\n} catch ( exception $e ) {<br \/>\n       echo &#8216;caught exception: &#8216; . $e->getMessage () . &#8216;, error trace: &#8216; . $e->getTraceAsString ();<br \/>\n}<\/p><\/blockquote>\n<p>\u0433\u044d\u0445 \u043c\u0430\u044f\u0433\u0430\u0430\u0440 \u0445\u0438\u0439\u043c\u044d\u044d\u0440 \u0431\u0430\u0439\u0434\u0430\u0433. \u041d\u044d\u0433 \u0442\u0430\u043b\u0430\u0430\u0441 PHP5 \u0440\u0443\u0443 \u0448\u0438\u043b\u0436\u0438\u0436 protected, private, final, abstract, interface, static members, __construct, __distruct, class constant, try catch \u0430\u0448\u0438\u0433\u043b\u0430\u043c\u0430\u0430\u0440 \u0431\u0430\u0439\u0434\u0430\u0433. \u041d\u04e9\u0433\u04e9\u04e9 \u0442\u0430\u043b\u0430\u0430\u0441 PHP4 \u043a\u043e\u0434\u0443\u0443\u0434 \u043c\u0430\u0430\u043d\u044c \u0430\u0441\u0443\u0443\u0434\u0430\u043b\u0433\u04af\u0439 \u0430\u0436\u0438\u043b\u043b\u0430\u0445\u044b\u043d \u0434\u044d\u044d\u0440 \u0438\u0445\u044d\u043d\u0445 \u0445\u043e\u0441\u0442 \u0434\u044d\u044d\u0440 \u0431\u0430\u0439\u0441\u0430\u0430\u0440 \u0431\u0430\u0439\u0434\u0430\u0433. \u042f\u0430\u044f \u0434\u0430\u0430 \u0431\u0430\u0439\u0437. \u0425\u044d\u0434\u0438\u0439\u0433\u044d\u044d\u0440 PHP4 \u043c\u0430\u0430\u043d\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0430\u043d\u0434\u0430\u043b\u0442\u044b\u0433 \u043c\u0443\u0443 \u0434\u044d\u043c\u0436\u0441\u044d\u043d \u0447 PHP5 \u0448\u0438\u0433 \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0430\u043d\u0434\u0430\u043b\u0442 \u0445\u0438\u0439\u0445 \u0433\u044d\u044d\u0434 \u041e\u0431\u044a\u0435\u043a\u0442 \u0445\u0430\u043d\u0434\u0430\u043b\u0442\u0430\u0442 \u0430\u0440\u0433\u0430\u0447\u043b\u0430\u043b\u044b\u0433 \u044d\u043b\u044d\u0433 \u0431\u04e9\u04e9\u0440\u04e9\u04e9\u0440 \u043d\u044c \u0437\u0430\u0434\u043b\u0430\u0430\u0434, \u043d\u0438\u0439\u043b\u04af\u04af\u043b\u0436 \u043a\u043e\u0434\u0447\u0438\u043b\u0436 \u0441\u0443\u0443\u0441\u0430\u0430\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u044b\u043d \u0431\u04af\u0442\u0446\u0438\u0439\u0433 \u043c\u0430\u0448 \u0441\u0430\u0439\u043d \u0441\u0443\u0440\u0433\u0430\u0434\u0430\u0433 \u044e\u043c \u0448\u0438\u0433 \u0441\u0430\u043d\u0430\u0433\u0434\u0441\u0430\u043d \u0448\u04af\u04af. \u042f\u043b\u0430\u043d\u0433\u0443\u044f\u0430 \u043c\u0430\u0448 \u043e\u043d\u043e\u0432\u0447\u0442\u043e\u0439 \u0430\u0440\u0433\u0430 \u0437\u0430\u043c\u044b\u0433 \u043e\u043b\u043e\u0445 \u0433\u044d\u044d\u0434 \u044f\u0430\u0436 reuse, singleton \u0437\u044d\u0440\u0433\u0438\u0439\u0433 \u0445\u0438\u0439\u0445 \u04af\u04af \u0433\u044d\u044d\u0434 \u043b \u043c\u04e9\u043d \u0447 \u0438\u0445 \u0431\u043e\u0434\u0441\u043e\u043d \u0441\u0430\u043d\u0430\u0433\u0434\u0430\u043d\u0430. \u0411\u043e\u043b\u043e\u0440 \u0410\u0423\u0421-\u043d MySQL \u043a\u043b\u0430\u0441\u0441 \u043b \u043b\u0430\u0432 zend\/php-\u043d mysqli -\u0441 \u0434\u0443\u0442\u0430\u0445\u0430\u0430\u0440\u0433\u04af\u0439 \u0445\u04af\u0447\u0438\u043d \u0447\u0430\u0434\u0430\u043b \u0431\u043e\u043b\u043e\u043d \u043e\u043d\u043e\u0432\u0447\u0442\u043e\u0439 \u0431\u043e\u043b\u0441\u043e\u043d \u044e\u043c\u0434\u0430\u0433.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430 \u0411\u043e\u043b\u043e\u0440 \u0410\u0423\u0421-\u044d\u044d \u0430\u043d\u0445 PHP 4.1- \u0434\u044d\u044d\u0440 \u0445\u04e9\u0433\u0436\u04af\u04af\u043b\u0436 \u044d\u0445\u044d\u043b\u0436\u044d\u044d. \u0413\u044d\u0442\u044d\u043b \u04e9\u043d\u04e9\u04e9\u0434\u04e9\u0440 \u043c\u0430\u0448 \u043e\u043b\u043e\u043d \u0441\u0435\u0440\u0432\u0435\u0440 \u0434\u044d\u044d\u0440 5.x \u044f\u0432\u0436 \u0431\u0430\u0439\u0434\u0430\u0433. \u041a\u043e\u0434 \u043c\u0430\u0430\u043d\u044c \u0445\u044d\u0434\u0438\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0445\u0430\u043d\u0434\u0430\u043b\u0442\u0430\u0442 \u0431\u043e\u043b\u043e\u0432\u0447 \u043d\u04e9\u0433\u04e9\u04e9 \u043b 4.x-\u0442\u044d\u0439\u0433\u044d\u044d \u0437\u043e\u0445\u0438\u0446\u043e\u0436 \u0430\u0436\u0438\u043b\u043b\u0430\u0436 \u0431\u0430\u0439\u0445\u044b\u043d \u0442\u0443\u043b\u0434 \u0445\u0443\u0443\u0447\u0438\u043d \u0437\u0430\u0433\u0432\u0430\u0440\u0430\u0430 \u0431\u0430\u0440\u044c\u0441\u0430\u0430\u0440 \u043b \u0431\u0430\u0439\u0434\u0430\u0433. \u0413\u044d\u0442\u044d\u043b \u0441\u04af\u04af\u043b\u0438\u0439\u043d \u04af\u0435\u0434 \u0448\u0443\u0443\u0434 PHP 5.3 \u0431\u043e\u043b\u043e\u043d \u0442\u04af\u04af\u043d\u044d\u044d\u0441 \u0445\u043e\u0439\u0448\u0445\u0438 \u0445\u0443\u0432\u0438\u043b\u0431\u0430\u0440\u0442 \u0437\u043e\u0440\u0438\u0443\u043b\u0430\u0430\u0434 \u0448\u0438\u043d\u044d\u0447\u043b\u044d\u043b\u0442 \u0445\u0438\u0439\u0447\u0438\u0445\u043c\u044d\u044d\u0440 \u0441\u0430\u043d\u0430\u0433\u0434\u0430\u0445 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[75,74,73,72],"class_list":["post-274","post","type-post","status-publish","format-standard","hentry","category-8","tag-object-oriented-programming","tag-php4-vs-php5","tag-php5","tag-72"],"_links":{"self":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts\/274"}],"collection":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=274"}],"version-history":[{"count":8,"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":276,"href":"https:\/\/www.badral.net\/index.php?rest_route=\/wp\/v2\/posts\/274\/revisions\/276"}],"wp:attachment":[{"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.badral.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}