Đang chuẩn bị liên kết để tải về tài liệu:
PHP 5/MySQL Programming- P35

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

PHP 5/MySQL Programming- P35:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 148 PHP 5 MySQL Programming for the Absolute Beginner city array Indianapolis New York Tokyo London distance array array 0 648 6476 4000 array 648 0 6760 3470 array 6476 6760 0 5956 array 4000 3470 5956 0 result distance cityA cityB print h3 The distance between print city cityA and city cityB print is result miles. h3 body html Storing City Names in the city Array I have two arrays in this program city and distance. The city array is a completely normal array of string values. It contains a list of city names. I set up the array so the numeric values I assigned to the city would correspond to the index in this array. Remember that array indices usually start with 0 so Indianapolis is 0 New York is 1 and so on. The user won t care that Indianapolis is city 0 so the city array assigns names to the various cities. If the user chose city 0 Indianapolis for the cityA field I can refer to the name of that city as city cityA because cityA contains the value 0 and city 0 is Indianapolis. Storing Distances in the distance Array The distances don t fit into a regular list because it requires two values to determine a distance. You must know from which city you are coming and going to calculate a distance. These two values correspond to rows and columns in the original table. Look again at the code that generates the distance array O 7 ÏI T VI distance array array 0 648 6476 4000 array 648 0 6760 3470 array 6476 6760 0 5956 array 4000 3470 5956 0 The distance array is actually an array full of other arrays Each of the inner arrays corresponds to distance from a certain destination city. For example since Indianapolis is city 0 the first zeroth inner array refers to the distance between Indy and the other cities. If it helps you can think of each inner array as a row of a table and the table as an array of rows. It might sound complicated to build a two-dimensional array but it is more natural than you may think. If you compare the original data in Table 5.1 with the code .

TÀI LIỆU LIÊN QUAN
Đã 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.