Tham khảo tài liệu 'tự học html và css trong 1 giờ - part 66', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 626 LESSON 21 Taking Advantage of the Server As you ll see a bit further on the ability to specify array indexes using variables is a staple of some kinds of loops in PHP. As you ve seen nothing distinguishes between a variable that s an array and a variable that holds a string or a number. PHP has a built-in function named is_array that returns true if its argument is an array and false if the argument is anything else. Here s an example is_array array 1 2 3 returns true is_array tree returns false To determine whether a particular index is used in an array you can use PHP s array_key_exists function. This function is often used to do a bit of checking before referring to a particular index for example if array_key_exists state_capitals Michigan echo state_capitals Michigan As mentioned previously it s perfectly acceptable to use arrays as the values in an array. Therefore the following is a valid array declaration stuff colors array red green blue numbers array one two three In this case I have an associative array that has two elements. The values for each of the elements are arrays themselves. I can access this data structure by stacking the references to the array indexes like this colors stuff colors Returns the list of colors. color stuff colors 1 Returns green number stuff numbers 0 Returns one Strings The most common data type you ll work with in PHP is the string type. A string is just a series of characters. An entire web page is a string as is a single letter. To define a string just place the characters in the string within quotation marks. Here are some examples of strings one 1 I like publishing Web pages. This string spans multiple lines. Download from The PHP Language 627 Take a look at the last string in the list. The opening quotation mark is on the first line and the closing quotation mark is on the second line. In PHP this is completely valid. In some programming languages strings that span multiple lines are illegal not so in