PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY you (Ftp web hosting)

PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY you can adopt any style you like. The important thing is to be consistent so that you can spot anything that looks out of place. The limited width of the printed page means that I normally use just two spaces to indent code in this book, but most people find that tabbing four or five spaces makes for the most readable code. Perhaps the biggest difference in styles lies in the way individual developers arrange curly braces. I align the closing brace with the block of code it concludes. Other writers use this style: if ($bytes > 51200) { // display error message and abandon upload } else { // continue upload } Yet others use this style: if ($bytes > 51200) { // display error message and abandon upload } else { // continue upload } Choose whichever style you re most comfortable with. As long as it s consistent and easy to read, that s all that matters. Using loops for repetitive tasks Loops are huge time-savers because they perform the same task over and over again, yet involve very little code. They re frequently used with arrays and database results. You can step through each item one at a time looking for matches or performing a specific task. Loops are particularly powerful in combination with conditional statements, allowing you to perform operations selectively on a large amount of data in a single sweep. Loops are best understood by working with them in a real situation, but details of all looping structures, together with examples, are in the second half of this chapter. Using functions for preset tasks As I mentioned earlier, functions do things . . . lots of things, mind-bogglingly so in PHP. The last time I counted, PHP had nearly 3,000 built-in functions, and more have been added since. Don t worry: you ll only ever need to use a handful, but it s reassuring to know that PHP is a full-featured language capable of industrial-strength applications. The functions you ll be using in this book do really useful things, such as get the height and width of an image, create thumbnails from existing images, query a database, send email,
You want to have a cheap webhost for your apache application, then check apache web hosting services.

Leave a Reply