Introduction to PHP - University of Michigan

Introduction To PHP University Of Michigan-ppt Download

  • Date:05 Aug 2020
  • Views:14
  • Downloads:0
  • Size:1.13 MB

Share Presentation : Introduction To PHP University Of Michigan

Download and Preview : Introduction To PHP University Of Michigan

Report CopyRight/DMCA Form For : Introduction To PHP University Of Michigan


Transcription:

Introduction to PHPDr Charles Severancewww php intro com About the PHP Language Syntax is inspired by C.
Curly braces semicolons no signficant whitespace Syntax inspired by perl Dollar signs to start variable names associative Extends HTML to add segments of PHP within anHTML file .
Philosphy of PHP You are a responsible and intelligentprogrammer You know what you want to do Some flexibility in syntax is OK style choices.
Lets make this as convienent as possible Sometimes errors fail silently h1 Hello from Dr Chuck s HTML Page h1 echo Hi there n answer 6 7 .
echo The answer is answer what echo was the question again n p Yes another paragraph p h1 Hello from Dr Chuck s HTML Page h1 echo Hi there n .
answer 6 7 echo The answer is answer what echo was the question again n p Yes another paragraph p PHP From the Command.
You can run PHP fromthe command line echo Hello World the output simply echo n comes out on the It does not have to be.
part of a request response cycle abstract Key Wordsand array as break casecatch class clone const continue.
declare default do else elseif enddeclare endfor endforeach endifendswitch endwhile extends final forforeach function global goto ifimplements interface instanceof.
namespace new or private protectedpublic static switch this throw try usevar while http php net manual en reserved php Variable Names.
Start with a dollar sign followed by a letter orunderscore followed by any number of letters numbers or underscores Case matters abc 12 abc 12 .
total 0 2php 0 largest so far 0 bad punc 0 http php net manual en language variables basics php Variable Name Weirdness.
Things that look like variables but are missing adollar sign can be confusing x 2 x 2 y x 5 y x 5 print y print x .
5 Parse error Expressions Completely normal like other languages More agressive implicit type conversion x 15 27 .
echo x 42echo n echo is a language construct x 15 27 can be treated like a echo x function with one parameter echo n .
Without parenthesis it echo x n accepts multiple parameters print x print n print is a function only one print x parameter but parenthesis print n .
are optional so it can look like a language construct Conditional if Logical operators and or Curly braces.
ans 42 if ans 42 print Hello world n else Hello World print Wrong answer n .
Whitespace does not ans 42 if ans 42 print Hello world n print Wrong answer n .
php ans 42 if ans 42 print Hello world n else print Wrong answer n What Style do You Prefer ans 42 php if ans 42 .
ans 42 if ans 42 print Hello world n print Hello world n else elseprint Wrong answer n .
print Wrong answer n Associative Arrays Like Python Dictonaries Lists but more Can be key value or simply indexed by Ignore two dimensional arrays for now .
Integer Indices stuff array Hi There echo stuff 1 n Integer Indices stuff array .
stuff Hello stuff World echo stuff 1 n Integer Indices stuff array .
stuff 2 Hello stuff 9 World echo stuff 9 n Key Value stuff array name Chuck .
course SI664 echo stuff course n Dumping an Array The function print r dumps out PHP data it isused mostly for debugging.
stuff array name Chuck course SI664 print r stuff name Chuck course SI664.
Dumping an Array The function print r dumps out PHP data it isused mostly for debugging stuff array stuff 2 Hello .
stuff 9 World print r stuff 2 Chuck 9 SI664 var dump vs print r.
stuff array name Chuck course SI664 var dump stuff array 2 name .
string 5 Chuck course string 5 SI664 http stackoverflow com questio... var dump is more.
thing FALSE echo One n print r thing echo Two n Onevar dump thing Two.
bool false http stackoverflow com questio... Looping Through an Array stuff array name Chuck course SI664 .
foreach stuff as k v echo Key k Val v n Key name Val ChuckKey course Val SI664 Variable Name Weirdness.
Things that look like variables but are missing adollar sign as an array index are unpredictable y array x Hello print y x String literals can use single quotes or double quotes.
The backslash is used as an escape character Strings can span multiple lines the newline is part ofthe string In double quoted strings variable values arehttp php net manual en .
language types string phpecho this is a simple string echo You can also have embedded newlines instrings this way as it isokay to do .
Outputs Arnold once said I ll be back echo Arnold once said I ll be back Outputs This will not expand n a newlineecho This will not expand n a newline Outputs Variables do not expand either.
echo Variables do not expand either php Quoteecho this is a simple string n echo You can also have embedded newlines instrings this way as it is.
okay to do Outputs This will expand a newlineecho This will expand na newline Outputs Variables do 12.
expand 12 echo Variables do expand n echo This is a test This is a c style comment This is a multi line commentyet another line of comment .
echo This is yet another test echo One Final Test This is a shell style commenthttp php net manual en languag... syntax comments php This is a sprint through the language features of.
Acknowledgements ContributionsContinue new Contributors and Translators hereThese slides are Copyright 2010 Charles R Severance www dr chuck com as part of www php intro com and madeavailable under a Creative Commons Attribution 4 0 License .
Please maintain this last slide in all copies of the document tocomply with the attribution requirements of the license If youmake a change feel free to add your name and organizationto the list of contributors on this page as you republish thematerials .
Initial Development Charles Severance University ofMichigan School of InformationInsert new Contributors and Translators here including namesIntroduction to PHP Dr. Charles Severance www.php-intro.com Note from Chuck. If you are using these materials, you can remove my name and URL from this replace it with your own, but please retain the CC-BY logo on the first page as well as retain the entire last page when you remix and republish these slides.

Related Presentations

Introduction to PHP Mahasarakham University

Web Development. FINAL 50%. Week5-6. Web Services. XML. Web Service Client. Web Service Server. Web2.0 Mashup. Week7. PHP template with Smarty

12 Views0 Downloads

PHP An Introduction

service support education extensions open source companies IBM uses and develops Apache and Linux; created Secure Mailer and created other software on AlphaWorks Apple released core layers of Mac OS X Server as an open source BSD operating system called Darwin; open sourcing the QuickTime Streaming Server and the OpenPlay network gaming toolkit ...

34 Views0 Downloads

Introduction to PHP

Data Types (1) PHP has eight different data types – 5 basic and 2 composite types and 1 resource type. The 5 basic data types are: integers: whole numbers in the range -2,147,483,648 to +2,147,483,647 on 32-bit architecture.

27 Views0 Downloads

Introduction to PHP Chakarov

PHP: Introduction By Trevor Adams Topics Covered Server side web programming Client/Server systems Comparison with static HTML PHP - what is it? What does it do? PHP Language basics Syntax Variables, Constants, Operators Decision making PHP and the client Client/Server on the WWW Standard web sites operate on a request/response basis A user ...

17 Views0 Downloads

Introduction to PHP instesre org

Introduction to PHP – Chapter 8 Working with PHP JavaScript vs. PHP PHP scripts are similar to JavaScript scripts, but be careful with syntax! PHP variables always begin with a “$” symbol. There is no equivalent to JavaScript’s “var” data declaration. PHP scripts are embedded within a <?php … ?> tag.

7 Views0 Downloads

Introduction to PHP WA4E

Introduction to PHP Last modified by: Sue Blumenberg Document presentation format: On-screen Show (16:9) Other titles: Helvetica MS Pゴシック Arial Gill Sans Lucida Grande ヒラギノ角ゴ ProN W3 Courier 1_Office Theme Office Theme PHP Arrays PHP Arrays Rock! Associative Arrays Integer Indices Key / Value Dumping an Array var_dump vs ...

15 Views0 Downloads

Introduction to PHP WPI

Introduction to PHP “PHP is a server-side scripting language designed specifically for the Web. Within an HTML page, you can embed PHP code that will be executed each time the page is visited. Your PHP code is interpreted at the Web server and generates HTML or other output that the visitor will see” (“PHP and MySQL Web Development ...

14 Views0 Downloads

Introduction to Server Side Development with PHP

PHP Comments. The types of comment styles in PHP are: Single-line comments. Lines that begin with a # are comment lines and will not be executed. Multiline (block) comments. These comments begin with a /* and encompass everything that is encountered until a closing */ tag is found. End-of-line comments

12 Views0 Downloads

Introduction to PHP and MySQL

Title: Introduction to PHP and MySQL Author: Lisa Dipippo Last modified by: Lisa DiPippo Created Date: 10/21/2003 8:11:01 PM Document presentation format

7 Views0 Downloads

Introduction to PHP

PHP and MySQL Web Development 2nd Edition, Welling & Thomson Web Database Applications with PHP & MySQL, O’Reilly Publishers PHP Cookbook, O’Reilly Publishers

13 Views0 Downloads

Expressions and Control Flow in PHP University of Michigan

Title: Expressions and Control Flow in PHP Last modified by: Charles Severance Document presentation format: Custom Other titles: Helvetica MS Pゴシック Arial Gill Sans Lucida Grande Courier Courier New Office Theme 1_Office Theme 2_Office Theme Expressions and Control Flow in PHP Expressions PowerPoint Presentation Operators of Note Increment / Decrement Increment / Decrement String ...

9 Views0 Downloads

PHP Southern Illinois University Carbondale

The cost to implement PHP is completely free. The PHP manual which is readily available at . www.php.net. is regarded as one of the best language manuals, making training very cost effective. The services needed for PHP can also be had for free, such as Apache server and MySql.

6 Views0 Downloads