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

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
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
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
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
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
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
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 

Último (20)

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
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
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
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
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
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
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
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
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 

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.