91精品综合久久久久久五月天_国产精品一区电影_中文字幕欧美日韩一区二区_亚洲一区二区三区精品动漫

New features in PHP 5.3

There is no doubt that PHP now has become the most popular WEB prescribe one of the technologies. According nexen.net survey, one-third of Internet sites selected to develop the PHP server-side program. In the U.S., Europe and Japan and other countries, PHP development market presents a scene of prosperity, such as Facebook, Yahoo!, Flickr, and such well-known PHP site Sourceforge numerous. China's major websites in recent years have gradually extensive use of PHP.

 

Rely on active, well-organized development community, PHP language itself has been steady progress - on the one hand continue to improve performance and stability, increase the range of practical tools; on the other hand actively learn the advantages of other programming languages to enrich the language features . Today's PHP, which can support a powerful object-oriented development (such as Java), it retains the easy to learn syntax (such as C), at the same time, PHP also has a very diverse range of practical functions, extensions and class libraries, very convenient for WEB Development. In addition, object-oriented development with the gradual popularization of various open source PHP class library and development framework endless.

 

By the end of June, PHP officially released PHP5.3.0. This is an unusual PHP version because it fixes a lot of Bug (over 140), but also brought a lot of PHP programmers for the long-awaited new features. Some features originally planned for PHP6 in the release, but a loud voice, in advance PHP5.3 released.

 

Let's look at what good things PHP5.3 in it.

 

1. New features in PHP 5.3

    * Support for namespaces (Namespace)

There is no doubt that the namespace is PHP5.3 brought the most important new features. With the concept of namespaces, in the development of a large site, is easier to design a flexible structure, while avoiding different package class name or variable name conflict.

In PHP5.3 before the division of practice is the way to Package the directory name to separate code file, the code in the class name is with an underscore _ to represent the directory. Such as

 

 

Code sample:

<? Php
class Zend_Db_Table_Select ()
/ / That present the class file is located in Zend / Db / Table / Select directory
?>

This naming is PEAR, Zend Framework, and various PHP projects used extensively. Although the method can be avoided in different packages or libraries in the class name conflicts, but when writing code are more cumbersome and clumsy.

In PHP5.3, the only need to specify the namespace can be different, the namespace separator for the anti-diagonals \.

 

 

 

Code sample:

<? Php
namespace Zend \ Db \ Table;
class Select ()
?>

This namespace exist even if the other class, called Select, the program in the call will not conflict. Readability is also increased.

    * Support the delay of static binding (Late Static Binding)

In PHP5, we can in the class through the self keyword or __CLASS__ to determine or call the current class. But there is a problem, if we call in the child class, get the result will be the parent class. Because the time of inheriting the parent class, static members have been bound. For example:

 

 

 

Code sample:

<? Php
class A (
    public static function who () (
        echo __CLASS__;
    )
    public static function test () (
        self:: who ();
    )
)

class B extends A (
    public static function who () (
         echo __CLASS__;
    )
)

B:: test ();
?>

Code above the output is:
A

This is different from our expectations, we want the original sub-class of the corresponding results.

PHP 5.3.0 adds a static keyword to reference the current class, which implements late static binding:

 

 

 

Code sample:

<? Php
class A (
    public static function who () (
        echo __CLASS__;
    )
    public static function test () (
        static:: who (); / / here to achieve a delay of static binding
    )
)

class B extends A (
    public static function who () (
         echo __CLASS__;
    )
)

B:: test ();
?>

Code above the output is:
B

 

    * Support for goto statement

Most computer programming languages support the unconditional shift statement goto, when the program execution to the goto statement, goto statement that is turned by the label that the procedures in place to continue. Despite the goto statement may cause the program flow is not clear, readable weakened, but in some cases with the convenience of its unique phenomena, such as interruption of the depth of nested loops and if statements.

 

 

Code sample:

<? Php
goto a;
echo 'Foo';
 
a:
echo 'Bar';

for ($ i = 0, $ j = 50; $ i <100; $ i + +) (
  while ($ j -) (
    if ($ j == 17) goto end;
  )
)
echo "i = $ i";
end:
echo 'j hit 17';
?>

    * Support for closures, Lambda / Anonymous Function

Closure (Closure) function and the concept of Lambda functions programmed in the field from the function. Such as JavaScript support closures and lambda functions in one of the most common language.

In PHP, we can also create_function () function is created when the code runs. But there is a problem: to create the function is compiled only when running, but not with the other code is compiled into executable code at the same time, we can not use this executable code like APC cache to improve performance of object code.

In PHP5.3, we can use the Lambda / anonymous function to define the temporary use (disposable type) function, as array_map () / array_walk () callback function such as function.

 

 

 

Code sample:

<? Php
echo preg_replace_callback ('~-([ az ])~', function ($ match) (
    return strtoupper ($ match [1]);
), 'Hello-world');
/ / Output helloWorld

 

$ Greet = function ($ name)
(
    printf ("Hello% s \ r \ n", $ name);
);

$ Greet ('World');
$ Greet ('PHP');

 

//... In a class

$ Callback = function ($ quantity, $ product) use ($ tax, & $ total) (
   $ PricePerItem = constant (__CLASS__. ":: PRICE_". Strtoupper ($ product));
   $ Total + = ($ pricePerItem * $ quantity) * ($ tax + 1.0);
 );
array_walk ($ products, $ callback);
?>

 

 

    * Added two magic methods __callStatic () and __invoke ()

PHP in there was a magic method __call (), when the code calls the object method does not exist a magic method that will be called automatically. New __callStatic () method only for a static class method. When there is no attempt to call a static class method, __callStatic () magic method will be called automatically.

 

 

 

Code sample:

<? Php
class MethodTest (
    public function __call ($ name, $ arguments) (
        / / $ Name parameter is case sensitive
        echo "call object method '$ name'"
             . Implode ('-', $ arguments). "\ N";
    )

    / ** PHP 5.3.0 or later in the class method is effective * /
    public static function __callStatic ($ name, $ arguments) (
        / / $ Name parameter is case sensitive
        echo "call the static method '$ name'"
             . Implode ('-', $ arguments). "\ N";
    )
)

$ Obj = new MethodTest;
$ Obj-> runTest ('by an object called');

MethodTest:: runTest ('static call'); / / As of PHP 5.3.0
?>

After the implementation of the above code the output is as follows:

  Call the object method 'runTest' - invoked by the object

Call the static method 'runTest' - static call

 

Form to call a function object, __invoke () method will be called automatically.

 

 

 

Code sample:

<? Php
class MethodTest (
    public function __call ($ name, $ arguments) (
        / / $ Name parameter is case sensitive
        echo "Calling object method '$ name'"
             . Implode (',', $ arguments). "\ N";
    )

    / ** PHP 5.3.0 or later in the class method is effective * /
    public static function __callStatic ($ name, $ arguments) (
        / / $ Name parameter is case sensitive
        echo "Calling static method '$ name'"
             . Implode (',', $ arguments). "\ N";
    )
)

$ Obj = new MethodTest;
$ Obj-> runTest ('in object context');

MethodTest:: runTest ('in static context'); / / As of PHP 5.3.0
?>

    * Added Nowdoc grammar, usage and Heredoc similar, but use single quotation marks. Heredoc you need to declare through the use of double quotation marks.

Nowdoc variable does not do any analysis, is suitable for passing a PHP code.

 

 

 

Code sample:

<? Php

 

/ / Nowdoc single quotes after PHP 5.3 support

$ Name = 'MyName';

echo <<<'EOT'
My name is "$ name".

EOT;

 

/ / The above code output My name is "$ name". ((Which variables are not parsed)

/ / Heredoc without quotation marks

echo <<<FOOBAR
Hello World!
FOOBAR;

 

/ / PHP 5.3 or later to support double quotes

echo <<<"FOOBAR"
Hello World!
FOOBAR;

 

?>

 

    * Support Heredoc to initialize static variables, class members and class constants.

Code sample:

<? Php
/ / Static variables
function foo ()
(
    static $ bar = <<<LABEL
Nothing in here ...
LABEL;
)

/ / Class member, constant
class foo
(
    const BAR = <<<FOOBAR
Constant example
FOOBAR;

    public $ baz = <<<FOOBAR
Property example
FOOBAR;
)
?>

    * Can also be used outside the class to define the constants const

PHP constants are usually defined in this way:

 

 

Code sample:

<? Php
define ("CONSTANT", "Hello world.");
?>

PHP5.3 add a constant defined by:

 

 

Code sample:

<? Php
const CONSTANT = 'Hello World';

?>

    * Ternary operator adds a quick way to write:?:

Original format is (expr1)? (Expr2): (expr3)
If expr1 result is True, the result of expr2 is returned.

PHP5.3 add a kind of writing style, you can omit the middle section, written as expr1?: Expr3
If expr1 result is True, then return the result of expr1

    * HTTP status codes in the 200-399 range were considered to be a successful visit
    * Support for dynamic invocation of static methods

Code sample:

<? Php
class Test
(
    public static function testgo ()
    (
         echo "gogo!";
    )
)

$ Class = 'Test';
$ Action = 'testgo';
$ Class:: $ action (); / / output "gogo!"
?>

    * Support nested handle the exception (Exception)
    * New garbage collector (GC), and enabled by default

2. PHP5.3 other noteworthy changes in the

 

1. A large number of bug fixes

2. PHP performance improvement

3. Php.ini variables can be used

4. Mysqlnd extend into the core theory, the expansion of access to mysql pace than in the previous MySQL and MySQLi extensions fast (see http://dev.mysql.com/downloads/connector/php-mysqlnd/)

5. Ext / phar, ext / intl, ext / fileinfo, ext/sqlite3 and ext / enchant other extensions by default with PHP bindings release. Phar which can be used to package PHP program, similar to Java in the jar mechanism.

6. Ereg regular expression functions are no longer available by default, use the faster of the PCRE regular expression functions

Conclusion:

PHP 5.3 is a great improvement in the PHP version, but it still follows the design principles of PHP - a powerful, easy to use. PHP5.3 the one hand, object-oriented development, and so be strengthened, so that PHP is more appropriate for enterprise application development on the other hand, also increased the number of useful features and a new extended syntax. We look forward to its early stabilization can, 成為 中 WEB development of another one Li Qi.

Declined comment

91精品综合久久久久久五月天_国产精品一区电影_中文字幕欧美日韩一区二区_亚洲一区二区三区精品动漫
国产福利一区视频| 日韩欧美亚洲在线| 色阁综合伊人av| 国产极品粉嫩福利姬萌白酱| 国产精品91久久久| 久久精品一区二区三区不卡免费视频| 久久免费精品视频| 国产精品一区二区免费看| 国产另类自拍| 99亚洲国产精品| 91精品久久久久| 国产成人永久免费视频| 精品久久久91| 欧美成aaa人片免费看| 欧美精品aaa| 熟女视频一区二区三区| 欧洲日本亚洲国产区| 国语自产精品视频在免费| 国产九九九九九| 99伊人久久| 色av中文字幕一区| 国产精品第七影院| 国产精品美女主播| 欧美成人第一页| 欧美另类99xxxxx| 精品国产免费av| 亚洲精蜜桃久在线| 欧美乱大交xxxxx潮喷l头像| 国产日韩在线精品av| 91超碰中文字幕久久精品| 日韩视频精品在线| 久久99久久99精品中文字幕| 欧美一级片中文字幕| 国内精品一区二区三区| 91久久国产精品| 久久精品色欧美aⅴ一区二区| 欧美激情区在线播放| 亚洲欧美日韩精品久久久| 欧美综合在线第二页| 国产精品一国产精品最新章节| 久久av一区二区| 国产精品久久久久久久久久直播| 伊人婷婷久久| 欧美综合在线观看| www.久久草| 国产精品日韩三级| 天堂一区二区三区| 国产欧美日韩亚洲| 久久久久久国产免费| 中文字幕日韩一区二区三区| 欧美一区二区在线视频观看| 国产乱码一区| 日韩在线中文视频| 亚洲精品久久久久久一区二区| 欧美精品123| 国产国语videosex另类| 欧美激情网站在线观看| 日韩精品一区二区三区电影| av网址在线观看免费| 国产精品视频久久久| 色中文字幕在线观看| 成人黄色一区二区| 国产精品久久久一区| 日本精品久久久久中文字幕 | 欧美一区二区三区免费视| 欧美成人精品免费| 国产成人av在线| 亚洲综合第一页| 免费国产a级片| 国产成人精品综合| 日本a级片在线播放| 91精品久久久久久久久中文字幕| 精品久久一二三| 蜜桃麻豆91| 国产精品久久久久91| 欧美又大粗又爽又黄大片视频| 91国内在线视频| 一区二区免费在线观看| 国产日韩精品在线观看| 国产精品私拍pans大尺度在线| 日本午夜一区二区三区| 国产极品精品在线观看| 亚洲伊人久久综合| 成人av在线天堂| 精品国产91亚洲一区二区三区www| 欧美成人高潮一二区在线看| 日韩亚洲一区二区| 欧美午夜性视频| 国产成人精品视频免费看| 欧美在线视频一区| 波霸ol色综合久久| 男女午夜激情视频| 国产精品久久91| 国产拍精品一二三| 在线一区亚洲| 国产欧美一区二区三区在线| 久久99久久99精品中文字幕| 国产伦精品一区二区三区照片 | 韩国精品久久久999| 国产精品久久中文字幕| 韩国福利视频一区| 国产精品高潮在线| 国产女大学生av| 亚洲二区自拍| 久久全国免费视频| 欧美亚洲视频一区| 精品国产自在精品国产浪潮| 黄色国产小视频| 萌白酱国产一区二区| 高清视频欧美一级| 色狠狠久久av五月综合|| 久艹在线免费观看| 狠狠综合久久av| 久久国产精品久久久久| 91精品综合久久久久久五月天| 日本视频精品一区| 国产精品第2页| 91九色综合久久| 欧美中日韩免费视频| 免费av在线一区| 久久久在线免费观看| 日韩激情视频一区二区| 国产精品免费观看高清| 成人动漫在线视频| 青青草综合在线| 欧美精品久久久久久久久久| 国产成人精品视频ⅴa片软件竹菊| 欧美一区二区视频在线播放| 精品免费久久久久久久 | 国产传媒久久久| 欧美黄色直播| 中文字幕一区综合| 国产成人久久久| 国产欧美精品一区二区三区-老狼| 在线观看欧美一区| 久久精品国产综合精品| 国产综合色香蕉精品| 亚洲淫片在线视频| 久久久久久久国产精品视频| 精品91一区二区三区| 亚洲色成人www永久在线观看 | 欧美性视频在线| 在线一区高清| 国产成人午夜视频网址| jizzjizz国产精品喷水| 日韩精品视频一区二区在线观看| 久久亚洲精品视频| 国产成人av在线| 成人国产在线看| 欧美日韩一道本| 亚洲欧美日韩在线综合| 国产精品对白刺激| 色婷婷综合成人av| 91精品国产成人| 国产欧美一区二区三区久久人妖| 日韩欧美视频一区二区三区四区| 伊人精品久久久久7777| 国产精品劲爆视频| 精品国产一区二区三区久久| 91精品久久久久久久久中文字幕| 狠狠色综合一区二区| 色噜噜狠狠色综合网| 欧美日韩成人网| 国产精品三级网站| 国产h视频在线播放| 69精品小视频| 99精彩视频| www亚洲国产| 国产精品稀缺呦系列在线| 国严精品久久久久久亚洲影视 | 久久久久久亚洲| 91国产在线精品| 国产毛片视频网站| 免费观看国产精品视频| 欧美亚洲第一区| 日韩精品不卡| 日韩免费高清在线观看| 日本一区二区三区四区在线观看| 午夜精品久久久久久久白皮肤| 久久久久久高潮国产精品视| 久久夜色精品国产亚洲aⅴ| 久久天堂av综合合色| 深夜福利91大全| 久久久久久久久国产精品| 久久久免费av| 日韩在线www| 国产成人精品999| 久久免费少妇高潮久久精品99| 91九色偷拍| 91成人在线视频观看| 久久久精品有限公司| 久久久久一区二区| 日韩专区在线播放| 精品国内亚洲在观看18黄| 国产精品视频一区二区高潮| 久久久国产影院| 久久综合免费视频| 精品中文字幕在线2019| 在线观看亚洲视频啊啊啊啊| 亚洲精品国产系列|