Wednesday, 23 March 2016

PHP Ruhrel Thar

PHP-7-ah thil thar kan hmu nual a, PHP hmelhriat tawh, hmelhriat tan leh la hmelhriat lutuk lo, a language zir rilruk ve deuh te tan PHP ruhrel thar (Internal Structure) PHP 7-a tunhnai maia an release chungchang hi sawilan ve thain ka hria a. Hetiang lam hre zawk te kut kuangkuaha thu mai mai te khan lo sit mai lovin lo belchiang ve ngei ula ka duh bawk a ni.

A hmasa ber chuan eng Software pawh a version thar an siam apiang hian a hma aia chak zawk tura code optimization hi a developer/programmer te'n an ngaihpawimawh ber te zinga mi a ni a. Hei hi Code refactoring ti tein an sawi thin bawk. PHP hmuchhuaktu, Rasmus Lerdorf chuan PHP 7 hi application hrang hranga 100% performance nei thei tur leh memory pawh heh lo ber tura duan a ni, tiin a sawi a. Hei bakah hian PHP khawlpui ber Zend Engine pawh thlak hlawkin hmingthar PHPNG (PHP Next Generation) tih an vuah sak a. Wordpress 4.1.1-a PHP version hrang hrang performance hi lo en ta ila, heta tang ringawt pawh hian PHP7 that zia chu hmuh hmaih chi a ni lo vang.


Performance-ah nasa takin hmasawnna kan hmuh bakah hian PHP7 hian Abstract Syntax tree (coding chepai kai) a rawn support tawh bawk a. Chuvangin Addons tool siam a awlsam tawh dawn bakah Static Analysis/profiling tan tangkai hle tura ngaih a ni bawk. Code kalphung danglam nasa tia sawi tur a awm lo va, Version hma lama yield hman apianga parenthesis ngai thin kha paih bo a ni tawh a, chutihrualin list() function argument nei lova hman thin erawh argument nei zela hman a ngai tawh thung dawn a. __clone magic method (hmanna ka neih awm pawh ka la hre lo) chu direct-a call theih a ni tawh bawk a. Thil dang an thlak danglam leh chu Uniform variable systax hi a ni a. Hei hian thil thlir dan thar leh zau zawk min siamsak bakah javascript code kalphung ang deuhva invoking function hman min phalsak a. Variable variable kalphung pawh thlak danglam a ni bawk. Thil thar dang leh chu 64-bit integer a rawn support hi a ni.

PHP7-ah hian PHP feature thenkhat paih leh thlak bakah dahbelh te an nei ve nual a. Version hma lama kan code hman kha depracated code a nih loh chuan la tha zel tura ngaih a ni. Code thenkhat dik thei lo erawh a awm ve zeuh thei bawk ang. PHP-a kan code dik loh vanga fatal error kan hmuh thin kha catchable-ah an dah vek thung a. Kan code ngai reng hmang si-a PHP 7-a insuan luh (upgrade) kan duh chuan hriat ngai leh thlak ngai tlema zawng a awm ve a. PHP-in complex variable variables a hriatthiam dan hi an thlak hlawk a, chuvangin variable variables i hmanna code chu uluk takin enfiah(test) phawt a fuh ber ang. assert() function hi configuration file atanga on leh off theihin an dah tawh bawk a. JSON extension an hman thin kha a free a nih loh vangin a free version-a thlak a ni tawh bawk a. Internal classes-ah error checking nan null i hman chuan exception anga an dah tawh avangin i code i revise ngei a ngai ang. is_numeric() function-ah hexadecimal number i pass chuan false a ni zel tawh ang. Hexadecimal leh a tlukpui decimal pawh i khaikhin chuan false a ni tawh bawk ang. Version hmasa lamah kha chuan tuna false kan tih te hi true an ni. Hexadecimal string leh Arithmetic Operator hman pawlh a rem tawh lo bawk a. Hexadecimal number te decimal number-a i convert duh chuan hexdec function hman tur a ni. Number pawh hexadecimal-a i convert duh chuan dechex function hman leh mai tur a ni. I code a uptodate chuan harsatna em em awm lovin PHP7-a i insuan zung zung thei ang. Version hma lama depracated code an tih ang chi kha PHP7-ah chuan an paih vek tawh avangin a hman theih loh a ni.

Version hmalama tangkai taka kan lo hman leh bel tawh PHP 7-a an paih te lo en thuak thuak leh ila. A hmasa ber chuan PHP 4 tanga kan hman mysql extension an paih hi a ni ang. Mak ve mai mai chu mysql ext hi kum 2015 hnu lam thleng pawha la hmang ngar ngar an la tam hle a. PHP 5.5 atang tawh khan injection attack laka a him loh em avangin hman tawh loh tura (deprecated) tih a ni a, mahse PHP zir tan tam zawk hi chuan an la hmang lui tho mai. PHP7-ah chuan mysqli or PDO chauh hman tur a ni ang. Mahse PHP7-ah hian mysql ext hi i la hmang duh cheu a nih chuan PECL(PHP Extension Community Library) atanga mysql extension hi install theih a la ni cheu tho. POSIX REGEX Functions te hi PHP 5.3 atanga hman tawh loh tura hluihlawn (depracated) an ni a. PHP 7-ah chuan paih vek an ni tawh a. Chung te chu: erec(), eregi(), ereg_replace(), eregi_replace(), split(),spliti(), sql_regcase() te hi an ni. PHP7-ah chian Perl-Compatible Regex (PCRE) functions an hmang vek tawh thung a ni. Mahse a mamawh tan chuan PECL atangin POSIX Regex hi install theih a ni vek bawk. PCRE-ah pawh hian paih an nei tho mai a, chu chu e modifier, preg_replace nena hman kawp thin hi a ni. Hei hi PHP 5.5 atang khan depracated a ni tawh nghe nghe. A aiah preg_replace_callback() function hman thung tur a ni.

Thil dang an paih leh chu PHP tag aia ASP tags hman theihna <% %> leh <%= %> te kha paih a ni a, HTML script tag <script language="php"></script> pawh paih tel a ni bawk. PHP 5.4 tang khan magic quote support tih tawp a ni tawh a. PHP7 ah chuan paih fai vek a ni. PHP.ini-a comment siam nan # symbol hman thin kha a tha lo tih an hmu chhuak leh tawh a, chuvangin ; (semicolon) chiah a hman theih tawh bawk.

Sawi tur tam tak a awm thei ang a, strict mode leh non strict mode a awm theih thu te hi chu topic ang deuh tawpa sawi zel a ngai tawh a. PHP7 i hmang dawn a nih chuan Error on vek a tha, error atanga inzir hi hriatnaah a cham rei bik a. Error hi developement-ah chuan ON ngei ngei tur a ni a, production-ah erawh OFF a tha zawk thung.
Error ON dan:

php.ini file-ah
display_errors=ON
error_reporting=E_ALL


php.ini file hi kan HOST-in kan edit theiha an dah loh pawhin kan server chuan Apache a hman chuan .htaccess hmangin error hi on theih tho a ni bawk a:

.htaccess file-ah
php_flag display_errors on
php_value error_reporting 32767


A tawp berah chuan PHP7-a thil thar langsar ber chu Zend Engine an siamthar PHPNG vanga a speed nasa taka an improve leh memory a mamawh tam lo hi a ni a; hei vang hian green version of php tia sawi a ni bawk.