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精品综合久久久久久五月天_国产精品一区电影_中文字幕欧美日韩一区二区_亚洲一区二区三区精品动漫
黄色一级一级片| 68精品久久久久久欧美| 综合色婷婷一区二区亚洲欧美国产| 国产成人久久婷婷精品流白浆| 久久久久久国产精品mv| 国产黄色片免费在线观看| 久久青青草原一区二区| 久久免费成人精品视频| 久久综合九色综合久99| 久精品国产欧美| 日韩有码在线播放| 国产精品色悠悠| 麻豆国产va免费精品高清在线| 久久久久久久久久久网站| 国产成人黄色av| 久久久精品国产一区二区| 国产精品久久综合av爱欲tv| 国产精品久久久久久久久久久久久| 国产精品日韩在线观看| 久久成年人免费电影| 亚洲一卡二卡区| 日韩免费观看av| 国内精品在线观看视频| 国产欧美123| 97国产精品久久| 久久免费一级片| 国产高清视频一区三区| 国产精品色午夜在线观看| 久久综合伊人77777蜜臀| 精品国产一区二区三区免费| 自拍另类欧美| 人妻精品无码一区二区三区| 蜜桃网站成人| 久久婷婷国产综合尤物精品| 国产精品日韩欧美| 亚洲一区亚洲二区| 欧美亚洲另类视频| av电影一区二区三区| 日韩在线观看免费网站| 精品乱码一区二区三区| 天天综合色天天综合色hd| 秋霞成人午夜鲁丝一区二区三区| 黄色片视频在线播放| 国产伦精品一区二区三区高清版 | 欧美怡红院视频一区二区三区| 激情五月宗合网| 91成人在线视频观看| 国产精品欧美风情| 午夜一区二区三区| 国产淫片av片久久久久久| 国产成人一区二区在线| 久久中文字幕国产| 欧洲熟妇精品视频| 97国产在线播放| 国产精品裸体瑜伽视频| 日韩一级在线免费观看| 国内成+人亚洲| 久久精品国产精品亚洲精品色| 精品国产电影| 欧美高清视频一区| 国产福利一区二区三区在线观看| 精品国产乱码久久久久久蜜柚 | 久久久精品国产网站| 一区二区在线不卡| 免费在线a视频| 国产成人成网站在线播放青青| 欧美极品美女电影一区| 欧美亚洲在线播放| 国产高清精品在线观看| 欧美精品xxx| 含羞草久久爱69一区| 久久久久久久久久久免费| 亚洲国产精品影视| 国产精品一级久久久| 精品久久久久久乱码天堂| 黄色片一级视频| www.日韩.com| 日本视频一区二区不卡| av日韩一区二区三区| 欧美激情一二三| 国产综合第一页| 国产精品极品尤物在线观看| 人妻av无码专区| 国产成人精品视| 三级网在线观看| 91精品国产成人| 午夜精品一区二区三区在线视 | 国产欧美韩日| 美女av一区二区三区| 美女黄毛**国产精品啪啪| 国产精品久久久久久久午夜| 狠狠干一区二区| 国产精品久久国产精品99gif | 欧美精品一区二区三区免费播放 | 久久人91精品久久久久久不卡| 亚洲一区二区三区在线观看视频| 高清不卡日本v二区在线| 欧美激情一级欧美精品| 国产乱子伦精品| 在线观看日韩羞羞视频| 91精品91久久久中77777老牛| 视频一区亚洲| 久久99导航| 欧美极品一区| 久久99久久久久久久噜噜| 国产免费人做人爱午夜视频| 欧美精品www| 91麻豆蜜桃| 日韩欧美亚洲日产国产| 国产精品丝袜一区二区三区| 免费观看精品视频| 亚洲在线免费观看| 久久国产精品精品国产色婷婷| 人妻无码久久一区二区三区免费 | 久久中文字幕在线| 国产精品一级久久久| 亚洲av首页在线| 久久精品magnetxturnbtih| 日韩尤物视频 | 国产精品久久久久秋霞鲁丝| 国产日韩欧美视频| 一道本在线观看视频| 国产激情999| 激情五月宗合网| 亚洲精品视频一二三| 久久久久久久久久婷婷| 国产拍精品一二三| 午夜探花在线观看| 久久精品国产v日韩v亚洲| 国产在线观看欧美| 午夜啪啪福利视频| 国产精品日韩二区| 99中文字幕| 欧美日韩精品免费观看| 中文字幕免费高| 日韩在线小视频| 国产精品一区二区三区久久久 | 麻豆一区二区三区在线观看| 欧美精品福利视频| 日韩视频中文字幕| 国产精品伊人日日| 欧洲精品码一区二区三区免费看| 欧美激情中文网| 国产精品爽爽爽爽爽爽在线观看| 成人毛片一区二区| 精品人妻人人做人人爽| 午夜精品视频在线观看一区二区| 国产精品视频免费在线| 久久综合毛片| 国产伦精品一区二区三区四区免费| 日韩精品一区二区在线视频| 欧美大片欧美激情性色a∨久久| 国产v片免费观看| 国产精品一区二区三区免费观看 | 欧美国产日韩激情| 无码人妻精品一区二区三区66| 国产精品高潮呻吟久久av无限| 国产成人亚洲综合青青| 国产精自产拍久久久久久蜜| 极品美女扒开粉嫩小泬| 日本一区二区三区视频在线播放 | 久久国产精品久久久久久| 久久久精品欧美| 久久琪琪电影院| 阿v天堂2017| 国产亚洲精品网站| 欧美成ee人免费视频| 青青青国产在线观看| 亚洲精品偷拍视频| 一区二区不卡在线| 精品国产一区二区三区麻豆小说| 久久精品人人爽| 精品激情国产视频| 日韩亚洲国产中文字幕| 久久精品丝袜高跟鞋| 91精品国产91久久久久麻豆 主演| 国产裸体写真av一区二区| 国产综合在线视频| 国外色69视频在线观看| 日韩美女免费观看| 日本不卡在线观看视频| 天堂一区二区三区| 午夜精品免费视频| 午夜欧美一区二区三区免费观看| 在线免费观看一区二区三区| 久久国产天堂福利天堂| 精品乱子伦一区二区三区| 国产精品久久久久一区二区| 久久人人爽人人爽爽久久| 日韩中文在线中文网三级| 久久久久久久久久久久久国产| 久久精品视频91| 日韩亚洲综合在线| 啊v视频在线一区二区三区 | 8090成年在线看片午夜| 91老司机精品视频| 久久久亚洲精选| 国产成人精品av| 国产成人精品在线视频| 国产精品极品尤物在线观看|