PHP7鏂扮壒鎬ф暣鐞嗕粙缁嶇瘒

姒傝堪

PHP7灏嗗湪2015骞10鏈堟寮忓彂甯冿紝PHP7 锛屽皢浼氭槸PHP鑴氭湰璇█鐨勯噸澶х増鏈洿鏂帮紝鍚屾椂灏嗗甫鏉ュぇ骞呯殑鎬ц兘鏀硅繘鍜屾柊鐨勭壒鎬э紝浠ュ強鏀硅繘涓浜涜繃鏃跺姛鑳姐 璇 鍙戝竷鐗堟湰灏嗕細涓撴敞鍦ㄦц兘鍔犲己锛屾簮鑷狿HP鐗堟湰鏍戜腑鐨刾hpng鍒嗘敮銆傚湪纭呰胺鍏徃鐨刏endCon浼氳锛孭HP宸ュ叿鍘傚晢Zend鎶鏈畼鏂硅璁簆hpng鍜 PHP7鐨勮繘搴︺傗滐紙鏈鍗囩骇锛夌湡姝d笓娉ㄤ簬甯姪涓氱晫鐨勫簲鐢ㄧ▼搴忔樉钁楀姞寮烘墽琛岄熷害锛屽啀鍔犱笂锛屾垜浠湪PHP涓殑鍏朵粬鏀硅繘锛屸漐end鐨勯甯墽琛屽畼瀹夎开鐗规浖鏂 锛堟浘鍙備笌浜哖HP璇█鐨勬寔缁紑鍙戝拰鍙戝睍锛夎〃绀恒

鏂扮壒鎬

PHP7寮曟搸( What will be in PHP 7 / PHPNG )

  • Performance Improvements with the addition of PHPNG engine.锛堜娇鐢≒HPNG寮曟搸鏉ユ彁鍗囨ц兘锛

  • PHPNG涓嶅啀浣跨敤zval鐨勪簩绾ф寚閽堛傚ぇ澶氭暟鍑虹幇鐨剒val**鍙橀噺鍜屽弬鏁伴兘灏嗘敼鍙樻垚zval*銆傜浉搴旂殑锛屼娇鐢ㄥ湪杩欎簺鍙橀噺涓婄殑瀹廧_PP()涔熼渶瑕佸彉鎴怹_P()銆

  • More -> https://wiki.php.net/phpng-upgrading

  • JIT - Just in Time compiler

  • 鍗虫椂缂栬瘧 (鍙傝冪櫨搴︾櫨绉戜粙缁)

  • Just In Time锛堝嵆鏃剁紪璇戯級鏄竴绉嶈蒋浠朵紭鍖栨妧鏈紝鎸囧湪杩愯鏃舵墠浼氬幓缂栬瘧瀛楄妭鐮佷负鏈哄櫒鐮併備粠鐩磋鍑哄彂锛屾垜浠兘寰堝鏄撹涓猴紝鏈哄櫒鐮佹槸璁$畻鏈鸿兘澶熺洿鎺ヨ瘑鍒拰鎵ц鐨勶紝姣旇捣Zend璇诲彇opcode閫愭潯鎵ц鏁堢巼浼氭洿楂樸傚叾涓紝HHVM锛圚ipHop Virtual Machine锛孒HVM鏄竴涓狥acebook寮婧愮殑PHP铏氭嫙鏈猴級灏遍噰鐢↗IT锛岃浠栦滑鐨凱HP鎬ц兘娴嬭瘯鎻愬崌浜嗕竴涓暟閲忕骇锛屾斁鍑轰竴涓护浜洪渿鎯婄殑娴嬭瘯缁撴灉锛屼篃璁╂垜浠洿瑙傚湴璁や负JIT鏄竴椤圭偣鐭虫垚閲戠殑寮哄ぇ鎶鏈

  • 閫氳繃JIT锛屽彲浠ラ檷浣嶸M鐨勫紑閿锛屽悓鏃讹紝閫氳繃鎸囦护浼樺寲锛屽彲浠ラ棿鎺ラ檷浣庡唴瀛樼鐞嗙殑寮鍙戯紝鍥犱负鍙互鍑忓皯鍐呭瓨鍒嗛厤鐨勬鏁般傜劧鑰岋紝瀵逛簬鐪熷疄鐨刉ordPress椤圭洰鏉ヨ锛孋PU鑰楁椂鍙湁25%鍦╒M涓婏紝涓昏鐨勯棶棰樺拰鐡堕瀹為檯涓婂苟涓嶅湪VM涓娿傚洜姝わ紝JIT鐨勪紭鍖栬鍒掞紝鏈鍚庢病鏈夎鍒楀叆璇ョ増鏈殑PHP7鐗规т腑銆備笉杩囷紝瀹冨緢鍙兘浼氬湪鏇村悗闈㈢殑鐗堟湰涓疄鐜帮紝杩欑偣涔熼潪甯稿煎緱鎴戜滑鏈熷緟鍝堛

  • Abstract Syntax Tree for compilation(鎶借薄璇硶鏍戠紪璇)

  • Asynchronous refactoring of the I/O layer. 瀵笽/O灞傜殑寮傛閲嶆瀯

  • Multi-threaded build in Web Server澶氱嚎绋嬫瀯寤篧eb鏈嶅姟鍣

  • Expanded use of ->, [], (), {}, and :: operators 鎵╁睍浣跨敤 ->, [], (), {}, 鍜 :: 绗﹀彿

  • 100% increase in performance鎬ц兘鎻愬崌 100% (搴旇鏄疩PS)

  • Cool Name: PHPNG 閰峰悕锛歅HPNG寮曟搸

Zval鐨勬敼鍙

PHP鐨勫悇绉嶇被鍨嬬殑鍙橀噺锛屽叾瀹烇紝鐪熸瀛樺偍鐨勮浇浣撳氨鏄痁val锛屽畠鐗圭偣鏄捣绾崇櫨宸濓紝鏈夊涔冨ぇ銆備粠鏈川涓婄湅锛屽畠鏄疌璇█瀹炵幇鐨勪竴涓粨鏋勪綋锛坰truct锛夈傚浜庡啓PHP鐨勫悓瀛︼紝鍙互灏嗗畠绮楃暐鐞嗚В涓烘槸涓涓被浼糰rray鏁扮粍鐨勪笢瑗裤

PHP5鐨刏val锛屽唴瀛樺崰鎹24涓瓧鑺,PHP7鐨刏val锛屽唴瀛樺崰鎹16涓瓧鑺傘
Zval浠24涓瓧鑺備笅闄嶅埌16涓瓧鑺傦紝涓轰粈涔堜細涓嬮檷鍛紝杩欓噷闇瑕佽ˉ涓鐐圭偣鐨凜璇█鍩虹锛岃緟鍔╀笉鐔熸倝C鐨勫悓瀛︾悊瑙c俿truct鍜寀nion锛堣仈鍚堜綋锛夋湁鐐逛笉鍚岋紝Struct鐨勬瘡涓涓垚鍛樺彉閲忚鍚勮嚜鍗犳嵁涓鍧楃嫭绔嬬殑鍐呭瓨绌洪棿锛岃寀nion閲岀殑鎴愬憳鍙橀噺鏄叡鐢ㄤ竴鍧楀唴瀛樼┖闂达紙涔熷氨鏄淇敼鍏朵腑涓涓垚鍛樺彉閲忥紝鍏湁绌洪棿灏辫淇敼浜嗭紝鍏朵粬鎴愬憳鍙橀噺鐨勮褰曚篃灏辨病鏈変簡锛夈傚洜姝わ紝铏界劧鎴愬憳鍙橀噺鐪嬭捣鏉ュ浜嗕笉灏戯紝浣嗘槸瀹為檯鍗犳嵁鐨勫唴瀛樼┖闂村嵈涓嬮檷浜嗐

涓嶉渶瑕佸紩鐢ㄧ殑绫诲瀷锛歂ULL銆丅oolean銆丩ong銆丏ouble
闇瑕佸紩鐢ㄧ殑绫诲瀷锛歋tring銆丄rray銆丱bject銆丷esource銆丷eference

鍐呴儴绫诲瀷zend_string

Zend_string鏄疄闄呭瓨鍌ㄥ瓧绗︿覆鐨勭粨鏋勪綋锛屽疄闄呯殑鍐呭浼氬瓨鍌ㄥ湪val锛坈har锛屽瓧绗﹀瀷锛変腑锛岃寁al鏄竴涓猚har鏁扮粍锛岄暱搴︿负1锛堟柟渚挎垚鍛樺彉閲忓崰浣嶏級銆

PHP鏁扮粍鐨勫彉鍖栵紙HashTable鍜孼end Array锛

鍦ㄧ紪鍐橮HP绋嬪簭杩囩▼涓紝浣跨敤鏈棰戠箒鐨勭被鍨嬭帿杩囦簬鏁扮粍锛孭HP5鐨勬暟缁勯噰鐢℉ashTable瀹炵幇銆傚鏋滅敤姣旇緝绮楃暐鐨勬鎷柟寮忔潵璇达紝瀹冪畻鏄竴涓敮鎸佸弻鍚戦摼琛ㄧ殑HashTable锛屼笉浠呮敮鎸侀氳繃鏁扮粍鐨刱ey鏉ュ仛hash鏄犲皠璁块棶鍏冪礌锛屼篃鑳介氳繃foreach浠ヨ闂弻鍚戦摼琛ㄧ殑鏂瑰紡閬嶅巻鏁扮粍鍏冪礌銆

褰撴垜浠氳繃key鍊艰闂竴涓厓绱犲唴瀹圭殑鏃跺欙紝鏈夋椂闇瑕3娆$殑鎸囬拡璺宠穬鎵嶈兘鎵惧闇瑕佺殑鍐呭銆傝屾渶閲嶈鐨勪竴鐐癸紝灏卞湪浜庤繖浜涙暟缁勫厓绱犲瓨鍌紝閮芥槸鍒嗘暎鍦ㄥ悇涓笉鍚岀殑鍐呭瓨鍖哄煙鐨勩傚悓鐞嗗彲寰楋紝鍦–PU璇诲彇鐨勬椂鍊欙紝鍥犱负瀹冧滑灏卞緢鍙兘涓嶅湪鍚屼竴绾х紦瀛樹腑锛屼細瀵艰嚧CPU涓嶅緱涓嶅埌涓嬬骇缂撳瓨鐢氳嚦鍐呭瓨鍖哄煙鏌ユ壘锛屼篃灏辨槸寮曡捣CPU缂撳瓨鍛戒腑涓嬮檷锛岃繘鑰屽鍔犳洿澶氱殑鑰楁椂銆

鏂扮増鏈殑鏁扮粍缁撴瀯锛岄潪甯哥畝娲侊紝璁╀汉鐪煎墠涓浜傛渶澶х殑鐗圭偣鏄紝鏁村潡鐨勬暟缁勫厓绱犲拰hash鏄犲皠琛ㄥ叏閮ㄨ繛鎺ュ湪涓璧凤紝琚垎閰嶅湪鍚屼竴鍧楀唴瀛樺唴銆傚鏋滄槸閬嶅巻涓涓暣鍨嬬殑绠鍗曠被鍨嬫暟缁勶紝鏁堢巼浼氶潪甯稿揩锛屽洜涓猴紝鏁扮粍鍏冪礌锛圔ucket锛夋湰韬槸杩炵画鍒嗛厤鍦ㄥ悓涓鍧楀唴瀛橀噷锛屽苟涓旓紝鏁扮粍鍏冪礌鐨剒val浼氭妸鏁村瀷鍏冪礌瀛樺偍鍦ㄥ唴閮紝涔熶笉鍐嶆湁鎸囬拡澶栭摼锛屽叏閮ㄦ暟鎹兘瀛樺偍鍦ㄥ綋鍓嶅唴瀛樺尯鍩熷唴銆傚綋鐒讹紝鏈閲嶈鐨勬槸锛屽畠鑳藉閬垮厤CPU Cache Miss锛圕PU缂撳瓨鍛戒腑鐜囦笅闄嶏級銆

Zend Array鐨勫彉鍖栵細

锛1锛 鏁扮粍鐨剉alue榛樿涓簔val銆

锛2锛 HashTable鐨勫ぇ灏忎粠72涓嬮檷鍒56瀛楄妭锛屽噺灏22%銆

锛3锛 Buckets鐨勫ぇ灏忎粠72涓嬮檷鍒32瀛楄妭锛屽噺灏50%銆

锛4锛 鏁扮粍鍏冪礌鐨凚uckets鐨勫唴瀛樼┖闂存槸涓鍚屽垎閰嶇殑銆

锛5锛 鏁扮粍鍏冪礌鐨刱ey锛圔ucket.key锛夋寚鍚憐end_string銆

锛6锛 鏁扮粍鍏冪礌鐨剉alue琚祵鍏ュ埌Bucket涓

锛7锛 闄嶄綆CPU Cache Miss銆

鍑芥暟璋冪敤鏈哄埗锛團unction Calling Convention锛

PHP7鏀硅繘浜嗗嚱鏁扮殑璋冪敤鏈哄埗锛岄氳繃浼樺寲鍙傛暟浼犻掔殑鐜妭锛屽噺灏戜簡涓浜涙寚浠わ紝鎻愰珮鎵ц鏁堢巼銆

閫氳繃瀹忓畾涔夊拰鍐呰仈鍑芥暟锛坕nline锛夛紝璁╃紪璇戝櫒鎻愬墠瀹屾垚閮ㄥ垎宸ヤ綔

PHP7鍦ㄨ繖鏂归潰鍋氫簡涓嶅皯鐨勪紭鍖栵紝灏嗕笉灏戦渶瑕佸湪杩愯闃舵瑕佹墽琛岀殑宸ヤ綔锛屾斁鍒颁簡缂栬瘧闃舵銆備緥濡傚弬鏁扮被鍨嬬殑鍒ゆ柇锛圥arameters Parsing锛夛紝鍥犱负杩欓噷娑夊強鐨勯兘鏄浐瀹氱殑瀛楃甯搁噺锛屽洜姝わ紝鍙互鏀惧埌鍒扮紪璇戦樁娈垫潵瀹屾垚锛岃繘鑰屾彁鍗囧悗缁殑鎵ц鏁堢巼銆

AST锛圓bstract Syntax Tree锛屾娊璞¤娉曟爲锛

AST鍦≒HP缂栬瘧杩囩▼浣滀负涓涓腑闂翠欢鐨勮鑹诧紝鏇挎崲鍘熸潵鐩存帴浠庤В閲婂櫒鍚愬嚭opcode鐨勬柟寮忥紝
璁╄В閲婂櫒锛坧arser锛夊拰缂栬瘧鍣紙compliler锛夎В鑰︼紝鍙互鍑忓皯涓浜汬ack浠g爜锛屽悓鏃讹紝璁╁疄鐜版洿瀹规槗鐞嗚В鍜屽彲缁存姢銆
more -> https://wiki.php.net/rfc/abstract_syntax_tree

杩欓噷鍐欏浘鐗囨弿杩

TLS锛圢ative Thread local storage锛屽師鐢熺嚎绋嬫湰鍦板瓨鍌級

PHP鍦ㄥ绾跨▼妯″紡涓嬶紙渚嬪锛學eb鏈嶅姟鍣ˋpache鐨剋oker鍜宔vent妯″紡锛屽氨鏄绾跨▼锛夛紝闇瑕佽В鍐斥滅嚎绋嬪畨鍏ㄢ濓紙TS锛孴hread Safe锛夌殑闂锛屽洜涓虹嚎绋嬫槸鍏变韩杩涚▼鐨勫唴瀛樼┖闂寸殑锛屾墍浠ユ瘡涓嚎绋嬫湰韬渶瑕侀氳繃鏌愮鏂瑰紡锛屾瀯寤虹鏈夌殑绌洪棿鏉ヤ繚瀛樿嚜宸辩殑绉佹湁鏁版嵁锛岄伩鍏嶅拰鍏朵粬绾跨▼鐩镐簰姹℃煋銆傝孭HP5閲囩敤鐨勬柟寮忥紝灏辨槸缁存姢涓涓叏灞澶ф暟缁勶紝涓烘瘡涓涓嚎绋嬪垎閰嶄竴浠界嫭绔嬬殑瀛樺偍绌洪棿锛岀嚎绋嬮氳繃鍚勮嚜鎷ユ湁鐨刱ey鍊兼潵璁块棶杩欎釜鍏ㄥ眬鏁版嵁缁勩

鑰岃繖涓嫭鏈夌殑key鍊煎湪PHP5涓渶瑕佷紶閫掔粰姣忎竴涓渶瑕佺敤鍒板叏灞鍙橀噺鐨勫嚱鏁帮紝PHP7璁や负杩欑浼犻掔殑鏂瑰紡骞朵笉鍙嬪ソ锛屽苟涓斿瓨鍦ㄤ竴浜涢棶棰樸傚洜鑰岋紝灏濊瘯閲囩敤涓涓叏灞鐨勭嚎绋嬬壒瀹氬彉閲忔潵淇濆瓨杩欎釜key鍊笺

Combined comparison Operator (<=>) 缁撳悎姣旇緝杩愮畻绗 (<=>)

// PHP 7涔嬪墠鐨勫啓娉曪細姣旇緝涓や釜鏁扮殑澶у皬functionorder_func($a,$b){return($a<$b)?-1:(($a>$b)?1:0);}// PHP鏂板鐨勬搷浣滅 <=>,perfectfunctionorder_func($a,$b){return$a<=>$b;}

Return Type Declarations 杩斿洖绫诲瀷澹版槑 鍜孲calar Type Declarations 鏍囬噺绫诲瀷澹版槑

PHP璇█涓涓潪甯搁噸瑕佺殑鐗圭偣灏辨槸鈥滃急绫诲瀷鈥濓紝瀹冭PHP鐨勭▼搴忓彉寰楅潪甯稿鏄撶紪鍐欙紝鏂版墜鎺ヨЕPHP鑳藉蹇熶笂鎵嬶紝涓嶈繃锛屽畠涔熶即闅忕潃涓浜涗簤璁傛敮鎸佸彉閲忕被鍨嬬殑瀹氫箟锛屽彲浠ヨ鏄潻鏂版ц川鐨勫彉鍖栵紝PHP寮濮嬩互鍙夌殑鏂瑰紡鏀寔绫诲瀷瀹氫箟銆傞櫎姝や箣澶栵紝杩樺紩鍏ヤ簡涓涓紑鍏虫寚浠eclare(strict_type=1);锛屽綋杩欎釜鎸囦护涓鏃﹀紑鍚紝灏嗕細寮哄埗褰撳墠鏂囦欢涓嬬殑绋嬪簭閬靛惊涓ユ牸鐨勫嚱鏁颁紶鍙傜被鍨嬪拰杩斿洖绫诲瀷銆

declare(strict_type=1);functionadd(int $a,int $b):int{return$a+$b}

濡傛灉涓嶅紑鍚痵trict_type锛孭HP灏嗕細灏濊瘯甯綘杞崲鎴愯姹傜殑绫诲瀷锛岃屽紑鍚箣鍚庯紝浼氭敼鍙楶HP灏变笉鍐嶅仛绫诲瀷杞崲锛岀被鍨嬩笉鍖归厤灏变細鎶涘嚭閿欒銆傚浜庡枩娆⑩滃己绫诲瀷鈥濊瑷鐨勫悓瀛︽潵璇达紝杩欐槸涓澶х闊炽
鏇翠负璇︾粏鐨勪粙缁嶏細
https://wiki.php.net/rfc/scalar_type_hints_v5
PHP7鏍囬噺绫诲瀷澹版槑RFC

鏂扮壒鎬ц娉

鏍囬噺绫诲瀷澹版槑

鏍囬噺绫诲瀷澹版槑 鏈変袱绉嶆ā寮: 寮哄埗 (榛樿) 鍜 涓ユ牸妯″紡銆 鐜板湪鍙互浣跨敤涓嬪垪绫诲瀷鍙傛暟锛堟棤璁虹敤寮哄埗妯″紡杩樻槸涓ユ牸妯″紡锛夛細 瀛楃涓(string), 鏁存暟 (int), 娴偣鏁 (float), 浠ュ強甯冨皵鍊 (bool)銆傚畠浠墿鍏呬簡PHP5涓紩鍏ョ殑鍏朵粬绫诲瀷锛氱被鍚嶏紝鎺ュ彛锛屾暟缁勫拰 鍥炶皟绫诲瀷銆

<?php// Coercive modefunctionsumOfInts(int...$ints){returnarray_sum($ints);}var_dump(sumOfInts(2,'3',4.1));

杈撳嚭锛歩nt(9)
瑕佷娇鐢ㄤ弗鏍兼ā寮忥紝涓涓 declare 澹版槑鎸囦护蹇呴』鏀惧湪鏂囦欢鐨勯《閮ㄣ傝繖鎰忓懗鐫涓ユ牸澹版槑鏍囬噺鏄熀浜庢枃浠跺彲閰嶇殑銆 杩欎釜鎸囦护涓嶄粎褰卞搷鍙傛暟鐨勭被鍨嬪0鏄庯紝涔熷奖鍝嶅埌鍑芥暟鐨勮繑鍥炲煎0鏄庯紙鍙傝 杩斿洖鍊肩被鍨嬪0鏄, 鍐呯疆鐨凱HP鍑芥暟浠ュ強鎵╁睍涓姞杞界殑PHP鍑芥暟锛
瀹屾暣鐨勬爣閲忕被鍨嬪0鏄庢枃妗e拰绀轰緥鍙傝
http://php.net/manual/zh/functions.arguments.php#functions.arguments.type-declaration

杩斿洖鍊肩被鍨嬪0鏄

PHP 7 澧炲姞浜嗗杩斿洖绫诲瀷澹版槑鐨勬敮鎸併 绫讳技浜庡弬鏁扮被鍨嬪0鏄庯紝杩斿洖绫诲瀷澹版槑鎸囨槑浜嗗嚱鏁拌繑鍥炲肩殑绫诲瀷銆傚彲鐢ㄧ殑绫诲瀷涓庡弬鏁板0鏄庝腑鍙敤鐨勭被鍨嬬浉鍚屻

<?phpfunctionarraysSum(array...$arrays):array{returnarray_map(function(array $array):int{returnarray_sum($array);},$arrays);}print_r(arraysSum([1,2,3],[4,5,6],[7,8,9]));

杈撳嚭锛

Array
(
[0] => 6
[1] => 15
[2] => 24
)

null鍚堝苟杩愮畻绗

鐢变簬鏃ュ父浣跨敤涓瓨鍦ㄥぇ閲忓悓鏃朵娇鐢ㄤ笁鍏冭〃杈惧紡鍜 isset()鐨勬儏鍐碉紝 鎴戜滑娣诲姞浜唍ull鍚堝苟杩愮畻绗 (??) 杩欎釜璇硶绯栥傚鏋滃彉閲忓瓨鍦ㄤ笖鍊间笉涓篘ULL锛 瀹冨氨浼氳繑鍥炶嚜韬殑鍊硷紝鍚﹀垯杩斿洖瀹冪殑绗簩涓搷浣滄暟銆

<?php// Fetches the value of $_GET['user'] and returns 'nobody'// if it does not exist.$username=$_GET['user']??'nobody';// This is equivalent to:$username=isset($_GET['user'])?$_GET['user']:'nobody';// Coalesces can be chained: this will return the first// defined value out of $_GET['user'], $_POST['user'], and// 'nobody'.$username=$_GET['user']??$_POST['user']??'nobody';?>

Spaceship operator 缁撳悎姣旇緝杩愮畻绗 (<=>)

<?php// Integersecho1<=>1;// 0echo1<=>2;// -1echo2<=>1;// 1// Floatsecho1.5<=>1.5;// 0echo1.5<=>2.5;// -1echo2.5<=>1.5;// 1// Stringsecho"a"<=>"a";// 0echo"a"<=>"b";// -1echo"b"<=>"a";// 1?>

Constant arrays using define() 鐨勫父閲忔暟缁

鐜板湪鍙互鐢 define() 瀹氫箟鏁扮粍甯搁噺銆傚湪 PHP 5.6锛屽彧鍙互琚畾涔変笌 const銆

<?phpdefine('ANIMALS',['dog','cat','bird']);echo ANIMALS[1];// outputs "cat"?>

Anonymous classes 鍖垮悕绫

閫氳繃鏂扮殑绫绘坊鍔犱簡鐢ㄤ簬鍖垮悕绫荤殑鏀寔銆傝繖浜涘彲浠ョ敤浜庝唬鏇垮畬鏁寸殑绫诲畾涔変竴娆℃х殑瀵硅薄

<?php interfaceLogger{publicfunctionlog(string $msg);}classApplication{private $logger;publicfunctiongetLogger():Logger{return$this->logger;}publicfunctionsetLogger(Logger $logger){$this->logger=$logger;}}$app=newApplication;$app->setLogger(newclassimplementsLogger{publicfunctionlog(string $msg){echo $msg;}});var_dump($app->getLogger());?>

杈撳嚭锛

object(class@anonymous)#2 (0) {
}

Unicode codepoint escape syntax Unicode缂栫爜杞Щ璇硶

杩 Unicode 缂栫爜浠ュ崄鍏繘鍒舵牸寮忥紝骞惰緭鍑鸿缂栫爜鍦 UTF-8 涓哄弻寮曞彿鎷捣鏉ョ殑瀛楃涓叉垨瀹氱晫绗︺備换浣曟湁鏁堢殑缂栫爜琚帴鍙椼

echo"\u{aa}";echo"\u{0000aa}";echo"\u{9999}";

Closure::call()

<?php classA{private $x=1;}// Pre PHP 7 code$getXCB=function(){return$this->x;};$getX=$getXCB->bindTo(newA,'A');// intermediate closureecho $getX();// PHP 7+ code$getX=function(){return$this->x;};echo $getX->call(newA);

寰呯画鈥
鏇村鍙傝冿細http://php.net/manual/zh/migration70.new-features.php


浠ヤ笂灏辨槸PHP7鏂扮壒鎬ф暣鐞嗕粙缁嶇瘒鐨勮缁嗗唴瀹癸紝鏇村淇℃伅璇峰叧娉∣D浜戝叾瀹冪浉鍏虫枃绔狅紒



鏈枃URL锛http://www.odweb.cn/news_show.html?id=140