TAILIEUCHUNG - PHP Developer's Dictionary- P5

PHP Developer's Dictionary- P5:PHP is an open source, server-side, HTML-embedded scripting language used to create dynamically generated Web pages. With an easy-to-use syntax and a large, extensible library of modules, PHP brings together the best of Perl, C++, and other languages. | PHP Developer s Dictionary This section describes PHP s use of arrays strings type conversions variables and constants. No programming language would be complete without these necessary items. If you are familiar with other programming languages these should be very intuitive. The syntax for most of these items is similar to the C programming language and their functionality is as you would expect. The following sections are not intended to be an exhaustive review of arrays variables and type conversions but rather a basic review. Arrays As with every programming language PHP would be incomplete if it did not include the capability to define and manipulate arrays. PHP supports arrays that are indexed by number and associative arrays. PHP also supports multidimensional arrays. Arrays are variables that contain multiple elements indexed by numbers or names. This means that a variable called FirstName 1 could contain the value Kaitlin whereas another variable called FirstName 2 could contain the value Austin. The variable name is FirstName and the index is the 1 or 2 . The array function in PHP is used to define an array and assign values to it. This function would be used like this CustomerName array Jean Loren Ted Gladys The elements in the CustomerName array can now be accessed by using the variable name and the index in the following way print CustomerName 3 This would print the name Gladys which is actually the fourth item in the array. Remember that array indexes begin at 0. Associative arrays are indexed with strings instead of numbers. This is useful when describing the contents of the element using the index. To define an associative array we use the array function and we must define both the key and value for each element. In the following example we create an associative array called Contacts with three elements FirstName Phone and Email. Contacts array Name Eric Phone 289- 9272 Email eric@ We can now access any of the fields of Contacts like .

Đã 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.