PHP 5/MySQL Programming- P22

PHP 5/MySQL Programming- P22: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 | 83 print verse 3 print chorus print verse 4 print chorus The program is to print the first verse then the chorus then the second verse then the chorus and so on. The details of how all these things are to be generated is left to the individual functions. This is an example of encapsulation. Encapsulation is good because it allows you to think about problems in multiple levels. At the highest level you re interested in the main ideas print the verses and chorus but you re not so concerned about the exact details. You use the same technique when you talk about your day I drove to work had some meetings went to lunch and taught a class. You don t usually describe each detail of each task. Each major task can be broken down into its component tasks later. If somebody asks you could really describe the meeting I got some coffee appeared to be taking notes furiously on my PDA got a new high score on Solitaire while appearing to take notes scribbled on the agenda and dozed off during a presentation. Returning a Value The chorus Function Another interesting thing about the code s main section code is the use of the print function. In the last program I simply said chorus and the program printed the verse. In this program I did it a little differently. The chorus function doesn t actually print anything to the screen. Instead it creates the chorus as a big string and sends that value back to the program which can do whatever it wants with it. This behavior isn t new to you. Think about the rand function. It always returns a value to the program. The functions in this program work the same way. Take another look at the chorus function to see what I mean function chorus output HERE .with a knick-knack br paddy-whack br give a dog a bone br this old man came rolling home br br br HERE return output end chorus Chapter 3 Controlling Your Code ith Conditions and Functions 84 PHP 5 MySQL Programming for the Absolute Beginner I began the function by creating a new variable called .

Không thể tạo bản xem trước, hãy bấm tải xuống
9    23    1    28-03-2023
57    10    2    28-03-2023
25    67    1    28-03-2023
Đã 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.