TAILIEUCHUNG - Beginning PHP6, Apache, MySQL Web Development- P4

Beginning PHP6, Apache, MySQL Web Development- P4:Welcome to Beginning PHP6, Apache, MySQL Web Development , your new trusty resource for assistance in creating your own dynamic web sites. There are a lot of technologies available that can be used to deliver great web sites, and we ’ re glad you chose the Apache/MySQL/PHP (sometimes referred to simply as AMP) approach. You may or may not have had a taste of these three components in the past, but either way we ’ re confident that you will be impressed with the power that lies within them | Chapter 2 Creating PHP Pages Using PHP6 wife array firstname Mileva lastname Einstein age 128 do the same for each table in your restaurant Then if someone asks you Hey what are the first names of the couple sitting at table one you can easily print the information with a few simple echo statements php echo table 1 husband firstname echo and echo table 1 wife firstname This script would produce the output Albert and Mileva. If you want to simply store a list and not worry about the particular order or what each value should be mapped to such as a list of states or flavors of ice cream you don t need to explicitly name the keys PHP can automatically assign numeric keys with integers starting with 0. This would be set up as follows php flavors flavors flavors blue raspberry root beer pineapple These would then be referenced like this php echo flavors 0 outputs blue raspberry echo flavors 1 outputs root beer echo flavors 2 outputs pineapple Sorting Arrays A common task you may find yourself doing with arrays is sorting their values. PHP provides many functions that making sorting array values easy. Here are just a few common array-sorting functions although you will find a more extensive list in Appendix C. sort array Sorts an array in ascending value order rsort array Sorts an array in descending value order asort array Sorts an array in ascending value order while maintaining the key value relationship arsort array Sorts an array in descending value order while maintaining the key value relationship 61 Part I Movie Review Web Site Try It Out Sorting Arrays Before we go further let s do a quick test on sorting arrays so you can see how the array acts when it is sorted. Type the following program in your text editor and call it . php flavors blue raspberry flavors root beer flavors pineapple sort flavors print_r flavors How It Works Notice anything weird in the preceding code Yes we ve introduced a new function print_r . This simply prints out information .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
6    6    0    10-08-2020
37    9    0    10-08-2020
202    6    0    10-08-2020
77    6    0    10-08-2020
3    5    0    10-08-2020
3    5    0    10-08-2020
3    7    0    10-08-2020
TÀI LIỆU LIÊN QUAN
19    16    0
182    15    0
138    6    0
3    7    0
142    12    0