PHP 5/MySQL Programming- P28

PHP 5/MySQL Programming- P28: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 | Building the Place Array I notice that each place is a string value associated with some number. I use the array directive to preload the place array with appropriate values. Zero has no corresponding place so I simply left the 0 element blank. place array on my thumb on my shoe on my knee on a door Like most places in PHP carriage returns don t matter when you re writing the source code. I put each place on a separate line just because it looked neater that way. Chapter 4 Loops and Arrays Writing Out the Lyrics The song itself is incredibly repetitive. Each verse is identical except for the verse number and place. For each verse the value of the verse variable is the current verse number. The corresponding place is stored in place verse . A large print statement in a for loop prints the entire code. print out song for verse 1 verse 4 verse print HERE This old man He played verse He played knick-knack place verse .with a knick knack paddy-whack give a dog a bone This old man came rolling home HERE end for loop The Fancy Old Man program illustrates very nicely the tradeoff associated with using arrays. Creating a program that uses arrays correctly often takes a little more planning than using control structures alone as in This Ol d Man . However the extra work up front pays off because the program is easier to modify and extend. 114 PHP 5 MySQL Programming for the Absolute Beginner Keeping Persistent Data Most traditional kinds of programming presume that the user and the program are engaging in a continual dialog. A program begins running might ask the user some questions responds to these inputs and continues interacting with the user until he indicates an interest in leaving the program. Programs written on a Web server are different. The PHP programs you are writing have an incredibly short life span. When the user makes a request to your PHP program through a Web browser the server runs the PHP interpreter the program that converts your PHP code into the .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.