php5.3介紹
Jun 08, 2016 pm 05:32 PMPHP?5.3?介紹
PHP?2008?魁北克-?Ilia?Alshanetsky
?.?新版本的特性
*?兼職老版本下的代碼
*?重點(diǎn)主要放在現(xiàn)有的功能的改進(jìn)
*?更少的bug
*?更快的發(fā)布周期
1.?命名空間(Namespaces)
*?PHP5.3最大的新功能
*?完全支持名字空間特征
*?大部分的功能的執(zhí)行在編譯時
*?簡化命名慣例
1)?更清晰的代碼
????不使用?Namespaces
????function?MY_wrapper()?{}
????class?MY_DB?{}
????define(''MY_COMM_STR'',?'''');
???
????MY_wrapper();
????new?MY_DB();
????MY_COMM_STR;
2)?使用?Namespaces
???
????namespace?MY;
???
????function?wrapper()?{}
???
????class?DB?{?}
???
????const?CONN_STR?=?'''';
???????????
???
????use?MY?AS?MY;
???
????wrapper();
???
????new?DB();
???
????CONN_STR;
???
3)?一個文件中多個名字空間
???
????namespace?LIB;
???
????class?MYSQL?{}
????class?SQLite?{}
???
????$b?=?new?SQLite(;
???
????namespace?LIB_EXTRA;
???
????class?MScrypt?{}
???
????$a?new?MScrypt();
???
????var_dump(
????????get_class($a),
????????get_class($b)
????};
???
????//?result:
????//?string(18)?"LIB_EXTRA::MScrypt"
????//?string(11)?"LIB::SQLite"
4)?名字空間的層級
????namespace?foo;
???
????function?strlen($foo)?{?return?htmlspecialchars($foo);?}
???
????echo?strlen("test");?//?test
????echo?::strlen("test")?//?4
????echo?namespace::strlen("test");?//?test
???
????*?function,?class?和?constant?引用在一個名字空間中首先指向這個名字空間,?其次才是一個全局的范圍
5)?名字空間?&?自動引入
????function?__autoload($var)?{?var_dump($var);?}?//?LIB::foo
????require?"./ns.php";
????/**
?????????namespace?LIB;
?????new?foo();
?????>
????*/
*?__autoload()?將處理為和名字空間的類名一起。
*?autoload?僅在?class?不在名字空間和全局范圍內(nèi)存在時觸發(fā)。
*?__autoload()?聲明在一個名字空間中將不別調(diào)用!
6)?其他的名字空間的語法技巧
????namespace?really::long::pointlessly::verbose::ns;
???
????__NAMESPACE__;?//?當(dāng)前的名字空間名稱
???
????class?a?{}
???
????get_class(?new?a()?);?//?really::long::pointlessly::verbose::ns::abs
???
????use?really::long::pointlessly::verbose::ns::a?AS?b;?//?從一個名字空間引用class
???
2.?改進(jìn)的性能
*?md5()?速度提高了大概10-15%
*?引擎中更好的堆棧實(shí)現(xiàn)
*?常量移到只讀內(nèi)存區(qū)
*?改進(jìn)Exception處理(更簡單?&?更少的代碼)
*?調(diào)用?(require/include)_once?去掉了使用open(2)(linux下的c函數(shù))
*?使用gcc4編譯的二進(jìn)制更小更快
整體性能提高?5-15%
3.?新的語言特性
1)?__DIR__
*?引入?__DIR__?magic常量?定位腳本的目錄
????echo?dirname(__FILE__);?//?
???
????/*?vs?*/
???
????echo?__DIR__;?//?>=?5.3
2)??:??操作符
*?允許從2個值的or/and表達(dá)式快速的獲取一個非空的值
???
????$a?=?true??:?false;?//?true;
????$a?=?false??:?true;?//?true;
????$a?=?""??:?1;?//?1
????$a?=?0??:?2;?//?2
????$a?=?array()??:?array(1);?//?array(1);
????$a?=?strlen("")??:?strlen("a");?//?1
???
3)?__callStatic()
???
????*?等價于?__call()?,?但它是為調(diào)用靜態(tài)方法準(zhǔn)備的
???
????class?helper
????{
????????static?function?__callStatic($name,?$args){
????????????echo?$name.''(''.implode('',''?$args).'')'';
????????}???????
????}
???
????helper::test("foo",?"bar");?//?test(foo,bar);
//?動態(tài)的函數(shù)/方法調(diào)用有點(diǎn)慢...
?
?4)?動態(tài)的調(diào)用靜態(tài)方法
?
*?php?現(xiàn)在允許?動態(tài)的調(diào)用靜態(tài)的方法
???
????class?helper
????{
????????static?function?foo(){
????????????echo?__METHOD__;`
????????}???
????}
???
????$a?=?"helper";
????$b?=?"foo";
???
????$a::$b();?//?helper::foo
//?動態(tài)的函數(shù)/方法調(diào)用有點(diǎn)慢...
5)?延遲靜態(tài)綁定
*?靜態(tài)處理從編譯時延遲到執(zhí)行時
???
????class?A
????{
????????public?static?function?whoami(){
????????????echo?__CLASS__;???
????????}
???????
????????public?static?function?identity(){
????????????self::whoami();???
????????}
????}
???
????class?B?extends?A
????{
????????public?static?function?whoami(){
????????????echo?__CLASS__;
????????}
????}
???
????B::identity();?//?A?
???
???
????class?A
????{
????????public?static?function?whoami(){
????????????echo?__CLASS__;???
????????}
???????
????????public?static?function?identity(){
????????????static::whoami();???
????????}
????}
???
????class?B?extends?A
????{
????????public?static?function?whoami(){
????????????echo?__CLASS__;
????????}
????}
???
????B::identity();?//?B?=?5.3
???
*?小心使用操作碼緩存,沒有向后兼容
6)?MySQLInd
*?特殊的,高速的專門為PHP設(shè)計的MySQL調(diào)用庫接口
*?更好的性能
*?內(nèi)存的使用優(yōu)化
*?內(nèi)置的驅(qū)動(不是適應(yīng)性的再次擴(kuò)展)
*?Many?future?options?due?to?tight?integration?with?PHP
*?目前還沒有PDO_MySQL?支持?mysql(i)?only?for?now
7)?INI?Magic
*?CGI/FastCGI?支持".htaccess"?形式的INI控制
*?用戶可以自己設(shè)定每個目錄的INI在php.ini中通過[PATH=/var/www/domain.com]設(shè)定
*?優(yōu)化錯誤處理
*?允許用戶使用INI變量和常量任何定義的INI文件中
*?其他幾個小的優(yōu)化
????用戶自定義的php.ini(.htaccess)?文件名.?默認(rèn)為".user.ini"
????user_ini.filename?=?".user.ini"
禁止這個特性?設(shè)置這個選項(xiàng)為空值
????用戶自定義php.ini?的緩存失效期(time-to-live)?秒數(shù).?默認(rèn)is?300s?(5分鐘)
????user_ini.cache_ttl?=?300s
???
????[PATH=/var/www/domain.com]
????variables_order?=?GPC
????safe_mode?=?1
????[my?varibles]
????somevar?=?"1234"
????anothervar?=?${somevar}????;?anothervar?==?somevar
????[ini?arrays]
????foo[bar]?=?1
????foo[123]?=?2
????foo[]?=?3
8)?擴(kuò)展的?OpenSSL?函數(shù)
*?使用?OpenSSL?Digest?函數(shù)
????foreach?(openssl_get_md_methods()?as?$d)?{//?MD4,?MD5,?SHA512...?(12?all?in?all)
????????echo?$d.?"?-?".?openssl_digest("foo",?"md5");?//?acbd18db4cc2f85cedef654fccc4a4d8
????}
*?使用?OpenSSL?加密函數(shù)
????//?BF-CBC,?AES-256?CFB1...?(54?all?in?all)
????foreach(openssl_get_cipher_methods()?as?$v)?{
????????$val?=?openssl_encrypt("value",?$v,?"secret");
????????openssl_decrypt($val,?$v,?"secret");?//?value
????}
*?擴(kuò)展的?openssl_pkey_new()?和?openssl_pkey_get_details()
函數(shù)?允許訪問?內(nèi)部的?DSA,?RSA?和?DH?密匙.
其目標(biāo)在PHP中實(shí)現(xiàn)一個簡單的OpenId
?9)?SPL(Standard?PHP?Library)?優(yōu)化
*?優(yōu)化嵌套的目錄迭代次數(shù)由文件系統(tǒng)迭代
*?引入?GlobIterator
*?各種各樣的數(shù)據(jù)結(jié)構(gòu)類:?雙鏈表,?堆棧,?隊(duì)列,?堆,?小型堆,?大型堆,?優(yōu)先級隊(duì)列
?
*?其他的很繞口的一些特征
10)?時間處理進(jìn)行擴(kuò)展了和添加
*?可控制的?strtotime()?由?date_create_from_format()實(shí)現(xiàn)
???
????$date?=?strtotime("08-01-07?00:00:00");
????var_dump(date("Y-m-d",?$date));?//?string(10)?"2008-01-07"
????$date?=?date_create_from_format("m-d-y",?"08-01-07");
????var_dump($date->format(''Y-m-d''));?//?string(10)?"2007-08-01"
*?添加了?date_get_last_errors(),并且返回時間語法分析的錯誤和警告
????array(4)?{
????????["warning_count"]?=>?int(0)
????????["warnings"]?=>?array(0)?{?}
????????["error_count"]?=>?int(2)
????????["errors"]=>
????????????array(2)?{
????????????????[2]=>?string(40)?"The?separation?symbol?could?not?be?found"
????????????????[6]=>?string(13)?"Trailing?data"
????????????}
????}
?11)?getopt()?優(yōu)化
*?影響?Windows?平臺
*?本地的執(zhí)行不依賴于本地getopt()實(shí)現(xiàn).
*?跨平臺支持長選項(xiàng)?(--option)
????//?input:?--a=foo?--b?--c
????var_dump(getopt("",?array("a:","b::","c")));
????/*?output:?array(3)?{
????????["a"]=>
????????string(3)?"foo"
????????["b"]=>
????????bool(false)
????????["c"]=>
????????bool(false)
????}?*/
?12)?XSLT?Profiling
*?引入?Xslt?Profiling?通過?setProfiling()實(shí)現(xiàn)
????$xslt?=?new?xsltprocessor();
????$xslt->importStylesheet($xml);
????$xslt->setProfiling("/tmp/profile.txt");
????$xslt->transformToXml($dom);
???
????Resulting?In:
????number?????????match?????name?????mode?????Calls?????Tot?100us?Avg
????????0?????????date?????????????????????????5?????????58???????11
????????????????????Total?????????????????????5?????????58
?13)?E_DEPRECATED?標(biāo)記
*?怎么樣將一個php發(fā)行為一個沒有錯誤的模式??廢棄
*?E_DEPRECATED用來指定廢棄的功能,或許未來的版本中會消除。
?14)?垃圾回收器
*?為復(fù)雜和長時間運(yùn)行腳本的執(zhí)行結(jié)束周期釋放內(nèi)存的清理
?
????????gc_enable();?//?允許垃圾回收
????????var_dump(gc_enabled());?//?true
????????var_dump(gc_collect_cycles());?//?某個元素的清理
????????gc_disable();?//?禁止垃圾回收
???????
?15)?NOWDOC
*?一個?HEREDOC?不再進(jìn)行轉(zhuǎn)譯
????????HEREDOC
????$foo?=?ONE
????this?is?$fubar
????ONE;
????/*?string(10)?"this?is"?*/
???
????????NOWDOC
&

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











??? ??? "??? ???? PIN ??? ?????"?? ???? ?????. ?? ?? ??? ??? ? ?? ?? ?? ?? ??? ???? ????? PIN ?? ??? ??? ?? ?????. ??? ?? ??? ???? Windows? ???? ?? ?????? ?? ???? ???? ????. ?? ?? ?? ????. ??? ??? ???? ???? ?? ??? ???? ?????. ???? Windows 11?? PIN? ????? ???? ??? ?????? ??? ??? ??? ???? ?? ? ???? ?? ???? ?? ?? ?? ?????. ??? ????? ???? ??? ? ? ????! ?? ?? ??? ?? ?? ???? ??? ????? ?? ?? ??? ??? ? ????. ?? ??

Windows 11? ???? ??? ???? ??? ??????. ???? ?????? ?? ? ???? ?? ??? ?? ??? ????? ??? ? ????. ? ?????? Windows ?? ???? ??? ???? ???? ??? ??? ? ??? ?? ??? ??? ?????. ? ??? ??? ???? ??? ?????? +? ?? ?? ?? ???. Windows?? ???? ???? ?? ??? ?????. ?? ?? ? ??? ?? ? 11" Width="643" Height="500" > ?? ??? ? ? ???? ?? ?? ?? ??? ?? ?? ?? ???? ?????. ?? ?? ? ?? ???? ?? ??? ????? ?? ??? ?? ???? ?? ??? ????? ?? ??? ?? ???? ?? ??? ???.

????? Windows 11? ?? ??? ??? ??? ???/?? ??? ?? ????. ??? ??? ???? ??? ? ????. ? ?????? ?? ???? ???? ??? ????? ????? ????? ??? ? ?? ??? ?? ??? ??? ?????. ?? ?? ??? ?? ?? ??? ??? ??? ? ????? ?, ?? ?? ???? ?? ?? ?? ??? ??? ????? ????? ???? ???? ??? ?? ?? ??? ??? ??? ? ????. ??? ??? ????? ?? ???? ?????. Windows 11?? ?? ??? ??? ???? ??? ?????? 1. ?? ?? ???? +? ?? ?? ?? ???. Windows"?? ??"?? ??? ??

?? ??? ???? ???? ?? ??? ??? ???? ??? ???? ? ?? ????. ? ?? ?? ??? ?? ???? ????? ???? ??? ??? ?? ? ? ??? ?? ????. ? ?? ??? ? ?? ??? ???? ????? ????. ??? ??? ???? ?? ? ?? ??? ?? ??? ?????? ??? ????????. ??? ???? ??? ?? ??? ? ?? ?? ??? ??? ?? ???? ? ????. Windows 11?? ?? ??? ??? ?? ??? ????? ??? ?????? 1. ?? ?? ???? ?? ??? ??? ?????. Windows??? ???? ???? ??? ?????. ?? ??? ??? ?????. ?? ??? ???? ?? ???? ??? ?????. "?? ??"? ?????.

Windows Installer ???? "OOBELANGUAGE" ?? ?? "??? ??????."? ?????? ??? ??? ?? Windows ??? ???? ??? ????. OOBE? ?? ?? ??? ??? ?????. ?? ????? ? ? ??? ?? OOBE ?? ??? ??? ?????. ??? ??? ????. OOBE ?? ???? ?????? ???? ? ??? ??? ? ????. ?? ?? – 1. OOBE ? ??? ?? “?? ??” ??? ?????. ??? ? ??? ?? ?? ????? ?????. 2. ?? ??? ???? ???? ?? ?????. ???? ?? ??? ? OOBE? ????? ???. 3. ????? ??? ??? ????. ???? ???? OOBE? ?? ??? ?????.

Windows 11? ????? ?? ??? ???? ?? ??? ?? ?? ???? ??? ????. ? ???? ???? ??? ??, ?? ???? ???? ??? ????. ??? ??? ?? ??? ????? ??? ??? ?????. ??? ?? ?? ???? ???? ??? ?? ??? ?? ? ???? ???? ? ???? ??? ??? ??? ????? ?? ??? ???? ??? ??? ???. Custom Zoom? ??: ??? ???? ?? ??? ????? ??? ?????. ? ?? ???? ? ?? ?? ? ? ??? ?????. ?? ??? ? ?? ?????? ???? ??? ?? ?? ???? ??? ? ????. ??? ????? ??? ????? ? ??? ? ? ????. ?? ?? ??? ??? ? ????? ??? ? ????. ??? 11? ???? ??

?? ??? ?? ??? ??? ??? ? ???? ????, ?? ??? ??? ? ? ?? ?????. ?? ??? ???, ???? ???, ???? ?? ????? ?? ? ??? ???. ??? ??? ?? ?? ??? ??? ? ???, ?? ??? UI ??? ??? Windows 11??? ?? ?????. ??? ???? ? ??? ?? ?? Windows 11?? ??? ???? ?? ??? ??? ????. Windows 11?? ??? ???? ?? [10?? ??] ?? ??? ???? ?? ??? ???? Windows 11?? ??? ??? ? ????. ???? ?? ???? ???? ???? ???? ???? ?????. ????. ?? 1: ?? ?? ?? ?? ??? ???? ? ????.

Windows? ?? ?? ?????? ??? ? ?? ?? 0xc004f069? ??? ?? ???? ???? ??? ????. ??? ????? ????? ?????? Windows Server? ???? ?? ?? ????? ? ??? ??? ? ????. ??? ?? ??? ???? ??? ???? ??? ?? ??? ?? ?? ???? ???? ??? ??????. ?? ?? - ?? ???? ??? ?? ????. ?? ?? ???? ?? ??????. Windows ?? ?? ????? ???? ?? ?????. ?? 1 – ????? ??? cmd ????? Windows Server Edition ???? ??????. 1?? – Windows Server ?? ?? ?? ???? ?? W ??? ???? ???.
