180 likes | 283 Views
Introduction to & Overview of PHP. Instructor: Joseph DiVerdi, Ph.D., MBA. PHP In Brief. PHP Is A Server-Side HTML-Embedded Cross-Platform Programming Language Provides a Means for Developers to Put Instructions in HTML Files to Create Dynamic Content. Explanations. Server-Side
E N D
Introduction to & Overview of PHP Instructor: Joseph DiVerdi, Ph.D., MBA
PHP In Brief • PHP Is A • Server-Side • HTML-Embedded • Cross-Platform • Programming Language • Provides a Means for Developers to Put Instructions in HTML Files to Create Dynamic Content
Explanations • Server-Side • PHP Code is Executed on the Server • HTML-Embedded • PHP Code is Inserted Directly in HTML • Cross-Platform • PHP Runs on Several Different (Server) OSes • Scripting Language • Difference Between Scripting & Programming Languages is Increasingly Small • More Semantic than Significant • Script is Not Compiled
PHP in Less Brief • PHP Provides a Means for Developers • To Put Instructions in HTML Files • The Instructions are Read & Parsed by Server • They Never Make It to the Browser • The Server Replaces PHP Code with Content • HTML etc. • Forerunner Technology is • Server Side Includes (SSI)
Other Developments • Need for HTML-Embedded Server-Side Scripting Technology was Apparent to Others • Microsoft went after this need with ASP • Active Server Pages • ASP Has Become Quite Popular • In Microsoft Shops • Many Developers Sought More Stable & Less Proprietary Solution • Enter PHP, an Open-Source Server-Parsed HTML-Embedded Programming Language
PHP Benefits • PHP's Primary Strength • Rapid Development of Web Pages • With Modest Amount of Dynamic Content • Developers Without Heavy Programming Experience • Enjoy PHP's Shallow Learning Curve • Complete Tasks Of Modest Complexity • Pulling Records From a Database & • Inserting Them Into an HTML Table
PHP Benefits • PHP Language Architecture • Simple but Powerful • Includes an Extremely Wide Variety of Functions • Suited for Many Tasks • Traditional Data Processing • Web-Oriented Functions
PHP Example <HTML> <HEAD> <TITLE>Welcome!</TITLE> </HEAD> <BODY> <?PHP phpinfo() ?> <!-- more HTML goes here... --> </BODY> </HTML>
PHP Weaknesses • PHP Remains an Immature Language • Without the Architectural Strengths or Extensibility of More Established Languages • Embedded Scripting • Program Code is Mixed With HTML • Some Developers Are Empowered By This • Others Find It Disorganized & Error-Prone • Prefer Separate Development Environments • For Each Web Component
PHP Weaknesses • Advanced Developers • With Experience in Perl, CGI, & mod_perl • May Find Less Reason to Spend Time with PHP • And This May be Entirely Justified • Because They Can Already Do What PHP Can
PHP Strengths • Developers Have Literally Flocked to PHP • Modest Learning Curve • Free & Open Development • Native Database Connectivity • Stability • Availability for a Variety of Server Platforms
In Summary • It is Important to Understand That PHP is not a Unique Solution to Web Development • We're Fortunate to Enjoy a Potpourri of Possible Web Development Tools • Many Tasks can be Performed with a Wide Variety of Technologies • Developers Must Weigh Many Factors in Choosing a Development Path • Previous & Current Experience • Platform Requirements & Support • Time-to-Market Requirements
PHP Documentation • PHP Is Still in an Early Stage of Development • Language Continues to Evolve Significantly • Printed Texts Tend to Lag Behind • Most Current Information Available On-Line • PHP On-Line Manual http://www.php.net/manual/en/
PHP Example <!DOCTYPE ... > <HTML> <HEAD> <TITLE>PHP Test Page</TITLE> </HEAD> <BODY> <?PHP phpinfo() ?> </BODY> </HTML> • Create File Named "php_info.php"
PHP Example <!DOCTYPE ... > <HTML> <HEAD> <TITLE>PHP Test Page</TITLE> </HEAD> <BODY> <?PHP print("<P>Here is some text.</P>"); ?> </BODY> </HTML> • Create File Named "test.php"
PHP Example <?PHP print("<P>\n"); print("Here is some text.\n"); print("</P>\n"); ?> • Modify "test.php"
PHP Example <!DOCTYPE ... > <HTML> <HEAD><TITLE>PHP Date Page</TITLE></HEAD> <BODY> <?PHP print("<P>\n"); print("The current date is: "); print(date("l F j, Y")); print("</P>\n"); ?> </BODY> </HTML> • Create File Named "date.php"
PHP Example <!DOCTYPE ... > <HTML> <HEAD><TITLE>PHP Time & Date Page</TITLE></HEAD> <BODY> <?PHP print("<P>\n"); print("The current time and date are: "); print(date("H:i:s \M\T, l F j, Y")); print("</P>\n"); ?> </BODY> </HTML> • Modify "date.php"