PHP 5/MySQL Programming- P11

PHP 5/MySQL Programming- P11: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 | 28 PHP 5 MySQL Programming for the Absolute Beginner Using Variables for More-Complex Pages While the Hello Jacob program was interesting there is no real advantage to using a variable. Check out another use for variables. Building the Row Your Boat Page Figure shows the Row Your Boat page. figure This program shows the words to a popular song. They sure repeat a lot. I chose this song in particular because it repeats the same verse three times. If you look at the original code for the program you see I used a trick to save some typing html head title Row Your Boat title head body h1 Row Your Boat h1 h3 Demonstrates use of long variables h3 verse HERE 29 Row Row Row your boat br Gently Down the stream br Merrily Merrily Merrily Merrily br Life is but a dream br br br HERE print h3 Verse 1 h3 print verse print h3 Verse 2 h3 print verse print h3 Verse 3 h3 print verse body html Chapter 2 Using Variables and Input Creating Multi-Line Strings You find yourself wanting to print several lines of HTML code at once. It can be very tedious to use quotation marks to indicate such strings especially because HTML also often uses the quotation mark symbol . PHP provides a special quoting mechanism which is perfect for this type of situation. The following line begins assigning a value to the verse variable verse HERE The HERE segment indicates this is a special multi-line string that ends with the symbol HERE. You can use any phrase you wish but I generally use the word HERE because I think of the three less-than symbols as up to. In other words you can think of the following as meaning verse gets everything up to HERE. verse HERE You can also think of HERE as a special quote sign which is ended with the value HERE. You can write any amount of text between HERE and HERE. You can put variables inside the special text and PHP replaces the variable with its value just like in ordinary quoted strings. The ending phrase HERE must be on a line by itself and there

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.