SlideShare una empresa de Scribd logo
1 de 25
PHP – An Introduction Albert Morita – UCR Libraries Systems Dept. December 9, 2004 Version 2.0
Agenda 1. Brief History of PHP 2. Getting started 3. Examples
Brief History of PHP ,[object Object],[object Object],[object Object],[object Object],[object Object]
Brief History of PHP  ,[object Object]
Why is PHP used? ,[object Object],[object Object]
Why is PHP used? ,[object Object],[object Object],[object Object]
Why is PHP used? ,[object Object],PHP Software Free Platform Free (Linux) Development Tools Free PHP Coder ,  jEdit
Getting Started ,[object Object],[object Object],<?php   echo “Hello World”;  ?> PHP CODE HTML HTML Starting tag Ending tag Notes <?php ?> Preferred method as it allows the use of PHP with XHTML <? ?> Not recommended. Easier to type, but has to be enabled and may conflict with XML <script language=&quot;php&quot;> ?> Always available, best if used when FrontPage is the HTML editor <% %> Not recommended. ASP tags support was added in 3.0.4
Getting Started ,[object Object],[object Object],Copy the code onto your web server and save it as “test.php”.  You should see “Hello World!” displayed.  Notice that the semicolon is used at the end of each line of PHP code to signify a line break. Like HTML, PHP ignores whitespace between lines of code. (An HTML equivalent is <BR>)  <html><head> <title>My First PHP Page</title> </head> <body> <?php echo &quot;Hello World!&quot;; ?> </body></html>
Getting Started ,[object Object],[object Object],<?php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){   echo “Today is Thursday!”;  } else{   echo “Today is not Thursday.”; } ?>
Getting Started ,[object Object],[object Object],[object Object],<?php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){   echo “Today is Thursday!”;  } else{   echo “Today is not Thursday.”; } ?>
Getting Started ,[object Object],<?php $today_dayofweek = date(“w”); if ($today_dayofweek == 4){   echo “Today is Thursday!”;  } else{   echo “Today is not Thursday.”; } ?>
Examples ,[object Object],[object Object]
Examples ,[object Object],[object Object],<html><head> <title>UCR Webmaster Support Group</title> <link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=“mycssfile.css&quot;> </head> <body> <table width=80% height=30> <tr><td> <div align=center> Page Title </div> </td></tr></table>
Examples ,[object Object],[object Object],<table width=80% height=30> <tr><td> <div align=center> UC Riverside Department<BR>   <a href=mailto:someuser@ucr.edu>someuser@ucr.edu</a> </div> </td></tr></table>  </body> </html>
Examples ,[object Object],[object Object],<?php // header include(“header.php”); ?> Insert content here! <?php // footer include(“footer.php”); ?>
Examples ,[object Object],[object Object],[object Object],[object Object],[object Object],Page 1 Content Page 5 Content Page 3 Content Page 2 Content Page 4 Content Header Footer
Examples ,[object Object],[object Object],[object Object],[object Object]
Examples ,[object Object],[object Object],<?php $COUNTER_FILE = “webcounter.txt&quot;; if (file_exists($COUNTER_FILE)) { $fp = fopen(&quot;$COUNTER_FILE&quot;, &quot;r+&quot;); flock($fp, 1); $hits = fgets($fp, 4096); $hits += 1;  fseek($fp,0); fputs($fp, $hits); flock($fp, 3); fclose($fp); }  ?>
Examples ,[object Object],[object Object],[object Object],This page has been viewed   <?php echo“$hits”; ?>   times.
Examples ,[object Object],[object Object],[object Object],[object Object],[object Object],<?php  echo“$hits”; ?>   visitors.
Examples ,[object Object],[object Object],[object Object],[object Object],[object Object]
Examples ,[object Object],[object Object],[object Object]
Additional Resources ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Additional Information ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Más contenido relacionado

La actualidad más candente

La actualidad más candente (13)

Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0Dynamic Web Pages Ch 1 V1.0
Dynamic Web Pages Ch 1 V1.0
 
Intro to-php-19 jun10
Intro to-php-19 jun10Intro to-php-19 jun10
Intro to-php-19 jun10
 
Web development
Web developmentWeb development
Web development
 
Php introduction and configuration
Php introduction and configurationPhp introduction and configuration
Php introduction and configuration
 
Top 100 PHP Questions and Answers
Top 100 PHP Questions and AnswersTop 100 PHP Questions and Answers
Top 100 PHP Questions and Answers
 
Basic php
Basic phpBasic php
Basic php
 
PHP
PHPPHP
PHP
 
Php
PhpPhp
Php
 
Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4Inroduction to XSLT with PHP4
Inroduction to XSLT with PHP4
 
phptutorial
phptutorialphptutorial
phptutorial
 
Php
PhpPhp
Php
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php interview-questions and answers
Php interview-questions and answersPhp interview-questions and answers
Php interview-questions and answers
 

Destacado

Social.alums.11.3.11
Social.alums.11.3.11Social.alums.11.3.11
Social.alums.11.3.11James Stewart
 
Social network and students @ Chiangmai University
Social network and students @ Chiangmai University Social network and students @ Chiangmai University
Social network and students @ Chiangmai University อ.อรชร maneesong
 
งานพรรณ
งานพรรณงานพรรณ
งานพรรณOrapan2529
 
งานพรรณ
งานพรรณงานพรรณ
งานพรรณOrapan2529
 
ทัศนคติของร้านค้าในมหาวิทยาลัยเชียงใหม่ต่อนักท่องเที่ยวชาวจีน
ทัศนคติของร้านค้าในมหาวิทยาลัยเชียงใหม่ต่อนักท่องเที่ยวชาวจีนทัศนคติของร้านค้าในมหาวิทยาลัยเชียงใหม่ต่อนักท่องเที่ยวชาวจีน
ทัศนคติของร้านค้าในมหาวิทยาลัยเชียงใหม่ต่อนักท่องเที่ยวชาวจีนอ.อรชร maneesong
 

Destacado (6)

Social.alums.11.3.11
Social.alums.11.3.11Social.alums.11.3.11
Social.alums.11.3.11
 
Social network and students @ Chiangmai University
Social network and students @ Chiangmai University Social network and students @ Chiangmai University
Social network and students @ Chiangmai University
 
งานพรรณ
งานพรรณงานพรรณ
งานพรรณ
 
Marcom 58 11 สค 2558
Marcom 58 11 สค 2558 Marcom 58 11 สค 2558
Marcom 58 11 สค 2558
 
งานพรรณ
งานพรรณงานพรรณ
งานพรรณ
 
ทัศนคติของร้านค้าในมหาวิทยาลัยเชียงใหม่ต่อนักท่องเที่ยวชาวจีน
ทัศนคติของร้านค้าในมหาวิทยาลัยเชียงใหม่ต่อนักท่องเที่ยวชาวจีนทัศนคติของร้านค้าในมหาวิทยาลัยเชียงใหม่ต่อนักท่องเที่ยวชาวจีน
ทัศนคติของร้านค้าในมหาวิทยาลัยเชียงใหม่ต่อนักท่องเที่ยวชาวจีน
 

Similar a Php intro (20)

Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Open Source Package PHP & MySQL
Open Source Package PHP & MySQLOpen Source Package PHP & MySQL
Open Source Package PHP & MySQL
 
Open Source Package Php Mysql 1228203701094763 9
Open Source Package Php Mysql 1228203701094763 9Open Source Package Php Mysql 1228203701094763 9
Open Source Package Php Mysql 1228203701094763 9
 
Linux Apache Php Mysql Lamp1273
Linux Apache Php Mysql Lamp1273Linux Apache Php Mysql Lamp1273
Linux Apache Php Mysql Lamp1273
 
Phpwebdev
PhpwebdevPhpwebdev
Phpwebdev
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpoint
 
IT Club @ NCP - PHP Workshop May 10, 2011
IT Club @ NCP - PHP Workshop May 10, 2011IT Club @ NCP - PHP Workshop May 10, 2011
IT Club @ NCP - PHP Workshop May 10, 2011
 
Php
PhpPhp
Php
 
PHP MySQL
PHP MySQLPHP MySQL
PHP MySQL
 
Php1
Php1Php1
Php1
 
What Is Php
What Is PhpWhat Is Php
What Is Php
 
Php
PhpPhp
Php
 
php basics
php basicsphp basics
php basics
 

Último

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Último (20)

social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

Php intro

  • 1. PHP – An Introduction Albert Morita – UCR Libraries Systems Dept. December 9, 2004 Version 2.0
  • 2. Agenda 1. Brief History of PHP 2. Getting started 3. Examples
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.