Đang chuẩn bị liên kết để tải về tài liệu:
PHP and MySQL Web Development - P13

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

PHP and MySQL Web Development - P13: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Variable Scope 27 In our sample application we might store the prices for each of the items on sale as constants.You can define these constants using the define function define TIREPRICE 100 define OILPRICE 10 define SPARKPRICE 4 Add these lines of code to your script. You will notice that the names of the constants are all in uppercase. This is a convention borrowed from C that makes it easy to distinguish between variables and constants at a glance. This convention is not required but will make your code easier to read and maintain. We now have three constants that can be used to calculate the total of the customer s order. One important difference between constants and variables is that when you refer to a constant it does not have a dollar sign in front of it. If you want to use the value of a constant use its name only. For example to use one of the constants we have just created we could type echo TIREPRICE As well as the constants you define PHP sets a large number of its own. An easy way to get an overview of these is to run the phpinfo command phpinfo This will provide a list of PHP s predefined variables and constants among other useful information. We will discuss some of these as we go along. Variable Scope The term scope refers to the places within a script where a particular variable is visible. The four types of scope in PHP are as follows Built-in superglobal variables are visible everywhere within a script. Global variables declared in a script are visible throughout that script but not inside functions. Variables used inside functions are local to the function. Variables used inside functions that are declared as global refer to the global variable of the same name. In PHP 4.2 onwards the arrays _GET and _POST and some other special variables have their own scope rules. These are known as superglobals and can be seen everywhere both inside and outside functions. 28 Chapter 1 PHP Crash Course The complete list of superglobals is as follows GLOBALS

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.