หน้าเว็บ

วันจันทร์ที่ 28 กุมภาพันธ์ พ.ศ. 2554

What’s New in PHP5?

    So what’s the big deal about PHP5? If you’re experienced with PHP4, you probably know about
object-oriented programming and the way this was handled with PHP4. If you’re unfamiliar with
PHP, but you’re familiar with other programming languages, you’ll probably find PHP5’s implementation
of object-oriented principles familiar. Luckily, things have become a lot easier with the
release of PHP5. However, there are other improvements and changes, such as more configuration
options in php.ini and a host of new array-related and other functions, besides just “better objectoriented
programming” handling. This chapter outlines these changes for you.

Object-Oriented Changes
    The changes that follow relate to the OOP model and associated features and related topics. The
majority of these changes are covered in greater detail in Chapter 2, but are also briefly outlined
here for your quick reference.

Passing Objects
One big impact of OOP changes in PHP5 is the way that variables are passed as parameters to functions.
In PHP4, by default, variables were passed by value instead of by reference, unless denoted
otherwise with the syntax &$varname. In PHP5, the default is to assign a value by reference.

Exceptions
In a nutshell, exceptions are the procedures that happen when something goes wrong. Instead of
your program completely halting when it reaches an unexpected error, you can now exert a little
more control over what the program should do when it reaches said error. You are probably familiar
with the set_error_handler() function available in PHP4. If you aren’t, the purpose of this
function is to define a user function for error handling. However, it had many limitations in its
implementation. For example, it would not work if the error was type E_ERROR, E_PARSE,

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

If you want an answer, you have to ask....