TAILIEUCHUNG - Web Publishing with PHP and FileMaker 9- P4

Web Publishing with PHP and FileMaker 9- P4:On the other hand, it would drive me nuts if you bought this book only to discover that it didn’t address your needs. In the spirit of customer satisfaction, please read the following introduction to get a sense of where I’m coming from, and whether you might get some good use out of this book. | Basic PHP Syntax 35 It would be nice to be able to say that you should always just use single quotes or always use double quotes. However you will probably find one or the other to be useful in certain situations. Conditional Structures You won t get far in PHP before you need to have your page make some decisions on its own. That s where conditional structures come into play. There are many conditional structures some even have alternate formats. I am going to focus on the one that I feel is the most useful in the widest number of cases the if else and elseif constructs. php name Susannah if name Susannah echo Yep it s her else echo Nope it s not her outputs Yep it s her 3 I start by assigning a value to the name variable. Then I open up an If block and check to see if name equals Susannah. If it does the code between the first set of curly braces is executed. Otherwise the code between the second set of curly braces after the else would trigger. Unlike statements the lines of a control structure do not need to be terminated by a semicolon. Take special note of the fact that the equivalency operator in the expression is a double equal sign. This is very important. Inadvertently using a single equal sign is a frequent source of bugs. CAUTION Gotcha If I had only used one equal sign the script wouldn t fail it just wouldn t perform as desired. It would reassign Susannah to the name variable and the if statement would evaluate to TRUE every time. This is confusing at first so for now just remember to make sure you use the double equal sign in your if statements You can nest if statements but it s often easier to use the elseif construct like so php name Susannah if name Lily echo Hi Lily elseif name Matt echo Hi Matt else 36 CHAPTER 3 Introduction to PHP echo Who s there outputs Who s there You can include as many elseif blocks as you want. The else block at the end of this example is a catchall that will handle any cases that evaluated to FALSE in all of the .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.