Programming Programming Languages

Advanced PHP Programming : A Practical Guide to Developing by George Schlossnagle PDF

By George Schlossnagle

ISBN-10: 0672325616

ISBN-13: 9780672325618

During the last 3 years personal home page has advanced from being a distinct segment language used so as to add dynamic performance to small websites to a robust software making robust inroads into large-scale, business-critical net structures.   The fast maturation of Hypertext Preprocessor has created a skeptical inhabitants of clients from extra conventional "enterprise" languages who query the readiness and talent of personal home page to scale, in addition to a wide inhabitants of Hypertext Preprocessor builders with no formal desktop technological know-how backgrounds who've discovered throughout the hands-on experimentation whereas constructing small and midsize purposes in Hypertext Preprocessor.   whereas there are numerous books on studying Hypertext Preprocessor and constructing small purposes with it, there's a severe lack of knowledge on "scaling" personal home page for large-scale, business-critical platforms. Schlossnagle's complex Hypertext Preprocessor Programming fills that void, demonstrating that Hypertext Preprocessor is prepared for firm net functions through displaying the reader tips to increase PHP-based functions for optimum functionality, balance, and extensibility.

Show description

Read Online or Download Advanced PHP Programming : A Practical Guide to Developing Large-scale Web Sites and Applications With PHP 5 PDF

Best programming: programming languages books

Read e-book online Generics and Collections in Java 5 PDF

This finished advisor indicates you ways to grasp an important alterations to Java because it was once first published. Generics and the tremendously accelerated assortment libraries have significantly elevated the facility of Java five and Java 6. yet they've got additionally careworn many builders who have not recognized how you can benefit from those new gains.

Additional info for Advanced PHP Programming : A Practical Guide to Developing Large-scale Web Sites and Applications With PHP 5

Example text

Using alternative, or short, names is confusing and misleading and makes code hard to maintain. One of the worst examples of confusing variable names that I have ever seen was a code fragment that performed some maintenance on a product subscription. Part of the maintenance involved swapping the values of two columns. Instead of taking the clean approach, like this: $first_query = “SELECT a,b FROM subscriptions WHERE subscription_id = $subscription_id”; $results = mysql_query($first_query); list($a, $b) = mysql_fetch_row($results); // perform necessary logic $new_a = $b; $new_b = $a; $second_query = “UPDATE subscriptions SET a = ‘$new_a’, B = ‘$new_b’ WHERE subscription_id = $subscription_id”; Mysql_query($second_query); the developers had chosen to select $a and $b out in reverse order to make the column values and variable names in the UPDATE match: $first_query = “SELECT a,b FROM subscriptions WHERE subscription_id = $subscription_id”; $results = mysql_query($first_query); list($b, $a) = mysql_fetch_row($results); // perform necessary logic $second_query = “UPDATE subscriptions SET a = ‘$a’, B = ‘$b’ WHERE subscription_id = $subscription_id”; Mysql_query($second_query); Avoiding Confusing Code Needless to say, with about 100 lines of logic between the original SELECT and the final UPDATE, the flow of the code was utterly confusing.

Many programmers consider it such a necessity that the Python scripting language actually uses indentation as syntax; if Python code is not correctly indented, the program will not parse! Although indentation is not mandatory in PHP, it is a powerful visual organization tool that you should always consistently apply to code. ($year % 100)) || ($year % 400 == 0)) { return 29; } else { return 28; } } else { return 31; } == Code Formatting and Layout Compare that with the following block that is identical except for indentation: if($month == ‘september’ || $month == ‘april’ || $month == ‘june’ || $month == ‘november’) { return 30; } else if($month == ‘february’) { if((($year % 4 == 0) && ($year % 100)) || ($year % 400 == 0)) { return 29; } else { return 28; } } else { return 31; } In the latter version of this code, it is easier to distinguish the flow of logic than in the first version.

Tags is a list of phpDocumentor tags. The following are some important phpDocumentor tags: Tag Description @package [package name] The package name @author [author name] The author information The type for the var statement following the comment @var [type] @param [type [description]] The type for the input parameters for the function following the block @return [type [description]] The type for the output of the function You start the documentation by creating a header block for the file: /** * This is an example page summary block * 31 32 Chapter 1 Coding Styles * This is a longer description where we can * list information in more detail.

Download PDF sample

Advanced PHP Programming : A Practical Guide to Developing Large-scale Web Sites and Applications With PHP 5 by George Schlossnagle


by Edward
4.0

Rated 4.22 of 5 – based on 24 votes