TAILIEUCHUNG - SAMS Teach Yourself PHP4 in 24 Hours phần 2

Khóa học lập trình web PHP trang bị cho học viên những kỹ năng cần thiết để sử dụng thành thạo ngôn ngữ PHP & MySQL, học làm web động một cách nhanh chóng và hiệu quả nhất trên công nghệ web . | 46 Figure The output of Listing as HTML source code. Adding Comments to PHP Code Code that seems clear at the time of writing can seem like a hopeless tangle when you come to amend it six months later. Adding comments to your code as you write can save you time later on and make it easier for other programmers to work with your code. NEW A comment is text in a script that is ignored by the interpreter. TERM Comments can be used to make code more readable or to annotate a script. Single line comments begin with two forward slashes or a single hash sign . All text from either of these marks until either the end of the line or the PHP close tag is ignored. this is a comment this is another comment Multiline comments begin with a forward slash followed by an asterisk and end with an asterisk followed by a forward slash . this is a comment none of this will be parsed by the interpreter 47 Summary You should now have the tools at your disposal to run a simple PHP script on a properly configured server. In this hour you created your first PHP script. You learned how to use a text editor to create and name a PHP document. You examined four sets of tags that you can use to begin and end blocks of PHP code. You learned how to use the print function to send data to the browser and you brought HTML and PHP together into the same script. Finally you learned about comments and how to add them to PHP documents. Q A Q Which are the best start and end tags to use A It is largely a matter of preference. For the sake of portability the standard tags php are probably the safest bet. Short tags are enabled by default and have the virtue of brevity. Q What editors should I avoid when creating PHP code A Do not use word processors that format text for printing such as Word for example . Even if you save files created using this type of editor in plain text format hidden characters are likely to creep into your code. Q When should I comment my code A This is a matter of preference

Đã 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.