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| 国产av不卡一区二区| 97色在线播放视频| 久久久伊人欧美| 精品一区二区久久久久久久网站| 午夜精品在线视频| 午夜在线视频免费观看| 日韩精品一区二区三区色欲av| 亚洲综合日韩中文字幕v在线| 国产精品精品视频| 黄色录像特级片| av动漫免费看| 久久99精品久久久久久久青青日本 | 精品嫩模一区二区三区| 久久久久久久久网站| 国产精品视频一| 国产精品高潮在线| 国产精品夫妻激情| 日韩精品电影网站| 欧美日韩亚洲第一| 国产综合在线观看视频| 国产一区国产精品| 国产成人黄色av| 久久精品美女视频网站| 欧美激情精品久久久久久变态| 欧美日韩国产91| 性欧美大战久久久久久久| 视频在线一区二区三区| 精品1区2区| 日韩在线视频中文字幕| 精品国产综合| 一本久道综合色婷婷五月| 黄色一级在线视频| 久久国产精品高清| 播播国产欧美激情| 亚洲精品国产系列| 日本高清不卡在线| 国产精品稀缺呦系列在线| 91精品视频在线免费观看| 久久五月天色综合| 欧美综合激情| 91精品国产综合久久久久久久久 | 视频一区三区| 韩国三级日本三级少妇99| 久久伦理网站| 久久久久久成人| 久久精品国产欧美亚洲人人爽| 日本亚洲欧洲精品| 国产日韩欧美一区二区| 国产精品网站入口| 欧美视频1区| 日韩中文字幕在线看| 欧美一级日本a级v片| 91好吊色国产欧美日韩在线| 国产成人精品一区二区在线| 亚州成人av在线| 中文字幕日韩一区二区三区不卡| 亚洲综合在线中文字幕| 欧美一区亚洲二区| 久久精品国产69国产精品亚洲| 日韩经典在线视频| 日韩videos| 国产小视频免费| 国产国语刺激对白av不卡| 亚洲午夜精品一区二区| 国产精品美乳一区二区免费| 热门国产精品亚洲第一区在线 | 电影午夜精品一区二区三区 | 久久亚洲春色中文字幕| 久久99精品视频一区97| 欧洲精品一区二区三区久久| www.亚洲一区| 麻豆av一区二区三区久久| 精品国产一区二区三 | 国产www免费| 欧美少妇一区二区三区| 国产精品久久久久久av福利| 麻豆蜜桃91| 亚洲成色www久久网站| 久久精品网站视频| 国产色综合一区二区三区| 亚洲国产欧洲综合997久久| 91久久久亚洲精品| 日韩免费高清在线| 精品免费日产一区一区三区免费 | 国产aⅴ夜夜欢一区二区三区| 99视频国产精品免费观看| 亚洲精品tv久久久久久久久| 久久一区免费| 激情欧美一区二区三区中文字幕| 亚洲精品日产aⅴ| 国产精品丝袜久久久久久不卡 | 欧美亚洲免费高清在线观看| 久久久久国产一区二区三区| 国产不卡精品视男人的天堂| 国内精品久久久久久久果冻传媒| 综合色婷婷一区二区亚洲欧美国产 | 日韩欧美一区二区三区久久婷婷| 国产精品免费一区二区| 99视频在线免费观看| 欧美专区福利在线| 一本大道熟女人妻中文字幕在线| 国产成人精品久久| 国产精品亚洲不卡a| 欧美成人一区二区在线| 无码内射中文字幕岛国片| 九九热精品视频国产| 国产成人免费av| 久久亚洲国产成人精品无码区| 免费观看国产成人| 日本免费在线精品| 欧美日韩国产123| 国产精品美女久久久免费| 久久久久久久一区二区| www.中文字幕在线| 国模一区二区三区私拍视频| 欧美一区二区大胆人体摄影专业网站 | 欧美一区二区视频17c| 欧美成年人视频| 国产成人免费av| 久久久久久亚洲精品| 91免费视频国产| 国产精品专区在线| 欧美精品二区三区四区免费看视频| 色综合久久久888| 国产精品免费在线| 久久综合一区| 国产精品99久久久久久大便| av电影一区二区三区| 国产精品一区在线免费观看 | 国产精品区免费视频| 日韩一级黄色av| 久久精彩视频| 久久国产精品免费一区| 久久综合久久综合这里只有精品| 91久久久国产精品| 99高清视频有精品视频| 韩国成人一区| 欧美高清一区二区| 青草青草久热精品视频在线观看 | 国产成人午夜视频网址| 久久亚洲a v| 68精品国产免费久久久久久婷婷| av无码久久久久久不卡网站| 国产精品夜色7777狼人| 欧美凹凸一区二区三区视频| 欧美日韩免费精品| 欧美国产视频在线观看| 欧美日韩高清在线一区| 欧美黄色免费影院| 国产在线视频欧美| 国产日韩三区| 国产精品影院在线观看| 成人精品视频久久久久| 91国自产精品中文字幕亚洲| 97久久精品国产| 99久久久精品视频| 91精品国产免费久久久久久| 7777在线视频| 国产成人亚洲欧美| 国产激情在线观看视频| 色妞在线综合亚洲欧美| 国产精品视频免费在线观看| 国产精品成人av性教育| 国产精品久久av| 亚洲最大福利视频网| 午夜精品理论片| 久久久中精品2020中文| 久久天天狠狠| 国产成人黄色av| 国产精品老牛影院在线观看| 精品国产一区二区三区日日嗨 | 欧美一区二视频在线免费观看| 欧美无砖专区免费| 国产综合精品一区二区三区| 欧美久久电影| 国产精品一二区| 久久久www免费人成黑人精品| 国产精品私拍pans大尺度在线| 美日韩精品免费观看视频| 亚洲国产另类久久久精品极度| 日韩精品一区二区三区色欲av| 国内自拍欧美激情| av免费中文字幕| 国产成人精品久久二区二区91| 国产精品久久久久福利| 精品国产一区二区三区久久久久久| 亚洲色婷婷久久精品av蜜桃| 日韩免费在线观看av| 久久久久久18| 色偷偷91综合久久噜噜| 欧美成人亚洲成人| 欧美一级欧美一级| 国产中文字幕二区| 久久伊人资源站| 久久成人亚洲精品| 日韩av在线第一页| 国产精品自拍视频| 国产精品久久7| 一区二区三区四区免费视频|