SlideShare a Scribd company logo
Muhammad Abdur Rahman AdnaN jhoroTEK.com [email_address]
[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],[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],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],<html> <!–-  Version information  -- --  File: page01.html  -- --  Author: COMP519  -- --  Creation: 15.08.06 -- --  Description: introductory page  -- --  Copyright: U.Liverpool  -- --> <head> <title> My first HTML document </title> </head> <body> Hello world! </body> </html> HTML documents begin and end with   <html>   and   </html>   tags Comments appear between   <!--   and   --> HEAD  section enclosed between   <head>   and   </head> BODY  section enclosed between   <body>   and   </body>
[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],[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]
A PHP scripting block starts with  <?php  and ends with  ?> .  A scripting block can be placed anywhere in HTML. <html> <!-- hello.php COMP519 --> <head><title>Hello World</title></head> <body> <p>This is going to be ignored by the PHP interpreter.</p> <?php   echo  ‘<p>While this is going to be parsed.</p>‘;  ?> <p>This will also be ignored by PHP.</p> <?php   print( ‘ <p> Hello and welcome to <i>my</i> page!</p> ' ) ;  ?> <? php // This is a comment /* This is a comment block */ ?> </body> </html>  The server executes the print and echo statements, substitutes output. print  and  echo for output a semicolon (;)  at the end of each statement (can be omitted at the end of block/file) //  for a single-line comment /*  and  */   for a large comment block.
[object Object],[object Object],<html><head></head> <!-- scalars.php COMP519 --> <body>  <p> <?php $foo = True; if ($foo) echo &quot;It is TRUE! <br /> &quot;; $txt='1234'; echo &quot;$txt <br /> &quot;; $a = 1234; echo &quot;$a <br /> &quot;; $a = -123;  echo &quot;$a <br /> &quot;; $a = 1.234;  echo &quot;$a <br /> &quot;; $a = 1.2e3;  echo &quot;$a <br /> &quot;; $a = 7E-10;  echo &quot;$a <br /> &quot;; echo 'Arnold once said: &quot;Iapos;ll be back&quot;', &quot;<br /> &quot;; $beer = 'Heineken';  echo &quot;$beer's taste is great <br /> &quot;; ?>  </p> </body> </html> Four scalar types:  boolean  TRUE or FALSE integer,  just numbers float  float point numbers string  single quoted double quoted
Arrays An array in PHP is actually an ordered map. A map is a type that maps values to keys. <?php $arr = array(&quot;foo&quot; => &quot;bar&quot;, 12 => true); echo $arr[&quot;foo&quot;]; // bar echo $arr[12];  // 1 ?> key  = either an integer or a string.  value  = any PHP type. <?php $arr = array(5 => 1, 12 => 2); $arr[] = 56;  // the same as $arr[13] = 56; $arr[&quot;x&quot;] = 42; // adds a new element unset($arr[5]); // removes the element unset($arr);  // deletes the whole array $a = array(1 => 'one', 2 => 'two', 3 => 'three'); unset($a[2]); $b = array_values($a); ?> can set values in an array unset()  removes a key/value pair *Find more on arrays array_values()  makes reindex effect (indexing numerically) Arrays An array in PHP is actually an ordered map. A map is a type that maps values to keys. array()  = creates arrays <?php $arr = array(&quot;foo&quot; => &quot;bar&quot;, 12 => true); echo $arr[&quot;foo&quot;]; // bar echo $arr[12];  // 1 ?> <?php array(5 => 43, 32, 56, &quot;b&quot; => 12); array(5 => 43, 6 => 32, 7 => 56, &quot;b&quot; => 12); ?> if  no key , the maximum of the integer indices + 1.  if  an existing key , its value will be overwritten. <?php array(5 => 43, 32, 56, &quot;b&quot; => 12); array(5 => 43, 6 => 32, 7 => 56, &quot;b&quot; => 12); ?> if  no key , the maximum of the integer indices + 1.  if  an existing key , its value will be overwritten. <?php $arr = array(5 => 1, 12 => 2); $arr[] = 56;  // the same as $arr[13] = 56; $arr[&quot;x&quot;] = 42; // adds a new element unset($arr[5]); // removes the element unset($arr);  // deletes the whole array $a = array(1 => 'one', 2 => 'two', 3 => 'three'); unset($a[2]); $b = array_values($a); ?> can set values in an array unset()  removes a key/value pair *Find more on arrays array_values()  makes reindex effect (indexing numerically)
Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],Example   Is the same as x+=y   x=x+y x-=y   x=x-y x*=y   x=x*y x/=y   x=x/y x%=y   x=x%y $a = &quot;Hello &quot;; $b = $a . &quot;World!&quot;; // now $b contains &quot;Hello World!&quot; $a = &quot;Hello &quot;; $a .= &quot;World!&quot;;
Conditionals: if else Can execute a set of code depending on a condition <html><head></head> <!-- if-cond.php COMP519 --> <body> <?php $d=date(&quot;D&quot;); if  ( $d==&quot;Fri&quot; ) echo &quot;Have a nice weekend! <br/>&quot;;  else echo &quot;Have a nice day! <br/>&quot;;  $x=10; if ($x==10) { echo &quot;Hello<br />&quot;;  echo &quot;Good morning<br />&quot;; } ?> </body> </html> if ( condition ) code to be executed if condition is  true ; else code to be executed if condition is  false ; date()  is a built-in function that can be called with many different parameters to return the date (and/or local time) in various formats In this case we get a three letter string for the day of the week.
[object Object],<html><head></head> <body> <?php  $i=1; while ( $i <= 5 ) { echo &quot;The number is $i <br />&quot;; $i++; } ?> </body> </html> loops through a block of code if and as long as a specified condition is true <html><head></head> <body> <?php  $i=0; do { $i++; echo &quot;The number is $i <br />&quot;; } while ( $i <= 10 ); ?> </body> </html> loops through a block of code once, and then repeats the loop as long as a special condition is true
[object Object],<?php for   ($i=1; $i<=5; $i++) { echo &quot;Hello World!<br />&quot;; } ?> loops through a block of code a specified number of times <?php $a_array = array(1, 2, 3, 4); foreach   ($a_array as $value)   { $value = $value * 2; echo “$value <br/> ”; } ?> loops through a block of code for each element in an array <?php  $a_array=array(&quot;a&quot;,&quot;b&quot;,&quot;c&quot;); foreach  ($a_array as $key=>$value) { echo $key.&quot; = &quot;.$value.&quot;&quot;; } ?>
[object Object],<?php function  foo( $arg_1 ,  $arg_2 , /* ..., */  $arg_n ) { echo &quot;Example function.&quot;; return   $retval ; } ?> Can also define conditional functions, functions within functions, and recursive functions. Can return a value of any type <?php function  takes_array( $input ) { echo &quot;$input[0] + $input[1] = &quot;, $input[0]+$input[1]; } takes_array(array(1,2)); ?> <?php function  square( $num ) { return   $num * $num ; } echo square( 4 ); ?> <?php function  small_numbers() { return  array (0, 1, 2); } list ($zero, $one, $two) = small_numbers(); echo $zero, $one, $two; ?>
[object Object],<?php $a = 1; /* global scope */  function Test() {  echo $a;  /* reference to local scope variable */  }  Test(); ?> The scope is local within functions. <?php $a = 1; $b = 2; function Sum() { global  $a, $b; $b = $a + $b; }  Sum(); echo $b; ?> global refers to its global version. <?php function Test() { static $a = 0; echo $a; $a++; } Test1();  Test1(); Test1(); ?> static   does not lose its value.
[object Object],[object Object]
[object Object],vars.php <?php $color = 'green'; $fruit = 'apple'; ?> test.php <?php echo &quot;A $color $fruit&quot;; //  A include  ' vars.php '; echo &quot;A $color $fruit&quot;; //  A green  apple ?> *The scope of variables in “included” files depends on where the “include” file is added! You can use the include_once, require, and require_once statements in similar ways .  <?php function foo() { global $color; include   ('vars.php‘); echo &quot;A $color $fruit&quot;; } /* vars.php is in the scope of foo() so  * * $fruit is NOT available outside of this  * * scope.  $color is because we declared it * * as global.   */ foo();  //  A green apple echo &quot;A $color $fruit&quot;;  //  A green ?>
[object Object],<?php $fh = fopen( &quot;welcome.txt&quot; ,&quot;r&quot; ) ; ?> r Read only.   r+ Read/Write. w Write only.   w+ Read/Write.   a Append.   a+ Read/Append. x Create and open for write only.   x+ Create and open for read/write. If the  fopen()  function is unable to open the specified file, it returns 0 (false). <?php if (!( $fh = fopen( &quot;welcome.txt&quot; ,&quot;r&quot; ) )) exit(&quot;Unable to open file!&quot;);  ?> For  w , and  a , if no file exists, it tries to create it (use with caution, i.e. check that this is the case, otherwise you’ll overwrite an existing file). For  x  if a file exists, it returns an error.
[object Object],<html> <-- form.html COMP519 --> <body> <form action=&quot; welcome.php &quot; method=&quot; POST &quot;> Enter your name: <input type=&quot;text&quot; name= &quot;name&quot;  /> <br/> Enter your age: <input type=&quot;text&quot; name= &quot;age&quot;  /> <br/> <input type=&quot;submit&quot; /> <input type=&quot;reset&quot; /> </form> </body> </html> <html> <!–-  welcome.php  COMP 519 --> <body> Welcome <?php echo  $_POST[ &quot;name&quot; ].”.” ; ?><br /> You are <?php echo  $_POST[ &quot;age&quot; ] ; ?> years old! </body> </html> $_POST   contains all POST data.   $_GET   contains all GET data. $_REQUEST   contains all GET & POST data.
[object Object],<?php  setcookie( &quot;uname&quot; , $_POST[ &quot;name&quot; ], time()+36000 ) ; ?> <html> <body> <p> Dear <?php echo $_POST[ &quot;name&quot; ] ?>, a cookie was set on this page! The cookie will be active when the client has sent the cookie back to the server. </p> </body> </html> NOTE: setcookie()   must appear  BEFORE  <html>  (or any output)   as it’s part of the header information sent with the page.  <html> <body> <?php if ( isset($_COOKIE[ &quot;uname&quot; ]) ) echo &quot;Welcome &quot; .  $_COOKIE[ &quot;uname&quot; ]  . &quot;!<br />&quot;; else echo &quot;You are not logged in!<br />&quot;; ?> </body> </html> use the cookie name as a variable isset() finds out if a cookie is set $_COOKIE contains all COOKIE data.
[object Object],<?php  session_start();  // store session data  $_SESSION['views']=1;  ?>  <html><body>  <?php  //retrieve session data  echo &quot;Pageviews=&quot;. $_SESSION['views'];  ?>  </body> </html>  NOTE: session_start()   must appear  BEFORE  <html>  (or any output)   as it’s part of the header information sent with the page.  <?php session_start();  if(isset($_SESSION['views'])) $_SESSION['views']=$_SESSION['views']+1; else $_SESSION['views']=1; echo &quot;Views=&quot;. $_SESSION['views'];  ?> use the session name as a variable isset() finds out if a session is set $_SESSION contains all SESSION data.
<?php session_destroy();  ?>  NOTE: session_destroy()   will remove all the stored data in session for current user.  Mostly used when logged out from a site. <?php unset($_SESSION['views']);  ?> unset() removes a data from session
[object Object],<?php //Prints something like: Monday echo  date(&quot;l&quot;); //Like: Monday 15th of January 2003 05:51:38 AM echo  date(&quot;l dS of F Y h:i:s A&quot;); //Like: Monday the 15th echo  date(&quot;l t jS&quot;); ?> date()  returns a string formatted according to the specified format. *Here is more on date/time formats:  http://php.net/date <?php $nextWeek =  time()  + (7 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60secs echo 'Now:  '.  date('Y-m-d')  .&quot;&quot;; echo 'Next Week: '.  date('Y-m-d', $nextWeek)  .&quot;&quot;; ?> time()  returns current Unix timestamp
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 

More Related Content

What's hot

Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
Caldera Labs
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Caldera Labs
 
Dev traning 2016 basics of PHP
Dev traning 2016   basics of PHPDev traning 2016   basics of PHP
Dev traning 2016 basics of PHP
Sacheen Dhanjie
 
PHP - Introduction to PHP
PHP -  Introduction to PHPPHP -  Introduction to PHP
PHP - Introduction to PHP
Vibrant Technologies & Computers
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
SHIVANI SONI
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
Ismail Mukiibi
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
olegmmiller
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
Collaboration Technologies
 
Class 6 - PHP Web Programming
Class 6 - PHP Web ProgrammingClass 6 - PHP Web Programming
Class 6 - PHP Web Programming
Ahmed Swilam
 
PHP Tutorials
PHP TutorialsPHP Tutorials
PHP Tutorials
Yuriy Krapivko
 
Using PHP
Using PHPUsing PHP
Using PHP
Mark Casias
 
Perl in the Internet of Things
Perl in the Internet of ThingsPerl in the Internet of Things
Perl in the Internet of Things
Dave Cross
 
Introduction to Web Programming with Perl
Introduction to Web Programming with PerlIntroduction to Web Programming with Perl
Introduction to Web Programming with PerlDave Cross
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
Bradley Holt
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
topher1kenobe
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
Anatoly Sharifulin
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
WP Engine UK
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
Shweta A
 
New in php 7
New in php 7New in php 7
New in php 7
Vic Metcalfe
 

What's hot (20)

Extending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh PollockExtending the WordPress REST API - Josh Pollock
Extending the WordPress REST API - Josh Pollock
 
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 Connecting Content Silos: One CMS, Many Sites With The WordPress REST API Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
Connecting Content Silos: One CMS, Many Sites With The WordPress REST API
 
Dev traning 2016 basics of PHP
Dev traning 2016   basics of PHPDev traning 2016   basics of PHP
Dev traning 2016 basics of PHP
 
PHP - Introduction to PHP
PHP -  Introduction to PHPPHP -  Introduction to PHP
PHP - Introduction to PHP
 
RESTful web services
RESTful web servicesRESTful web services
RESTful web services
 
Constructor and encapsulation in php
Constructor and encapsulation in phpConstructor and encapsulation in php
Constructor and encapsulation in php
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
Create a web-app with Cgi Appplication
Create a web-app with Cgi AppplicationCreate a web-app with Cgi Appplication
Create a web-app with Cgi Appplication
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Class 6 - PHP Web Programming
Class 6 - PHP Web ProgrammingClass 6 - PHP Web Programming
Class 6 - PHP Web Programming
 
PHP Tutorials
PHP TutorialsPHP Tutorials
PHP Tutorials
 
Using PHP
Using PHPUsing PHP
Using PHP
 
Perl in the Internet of Things
Perl in the Internet of ThingsPerl in the Internet of Things
Perl in the Internet of Things
 
Introduction to Web Programming with Perl
Introduction to Web Programming with PerlIntroduction to Web Programming with Perl
Introduction to Web Programming with Perl
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Working with WP_Query in WordPress
Working with WP_Query in WordPressWorking with WP_Query in WordPress
Working with WP_Query in WordPress
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
 
New in php 7
New in php 7New in php 7
New in php 7
 

Similar to Introduction To Lamp

Php Crash Course
Php Crash CoursePhp Crash Course
Php Crash Coursemussawir20
 
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.0Cathie101
 
Open Source Package PHP & MySQL
Open Source Package PHP & MySQLOpen Source Package PHP & MySQL
Open Source Package PHP & MySQL
kalaisai
 
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 9isadorta
 
Php Calling Operators
Php Calling OperatorsPhp Calling Operators
Php Calling Operatorsmussawir20
 
Php
PhpPhp
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в MagentoMagecom Ukraine
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpointwebhostingguy
 
PHP Presentation
PHP PresentationPHP Presentation
PHP PresentationNikhil Jain
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
Wildan Maulana
 
John Rowley Notes
John Rowley NotesJohn Rowley Notes
John Rowley Notes
IBAT College
 
Php Training
Php TrainingPhp Training
Php Training
adfa
 
PHPTAL introduction
PHPTAL introductionPHPTAL introduction
PHPTAL introduction
'"">
 

Similar to Introduction To Lamp (20)

Php Crash Course
Php Crash CoursePhp Crash Course
Php Crash Course
 
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
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
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
 
PHP MySQL
PHP MySQLPHP MySQL
PHP MySQL
 
Web development
Web developmentWeb development
Web development
 
Php Calling Operators
Php Calling OperatorsPhp Calling Operators
Php Calling Operators
 
Php
PhpPhp
Php
 
Php 3 1
Php 3 1Php 3 1
Php 3 1
 
Система рендеринга в Magento
Система рендеринга в MagentoСистема рендеринга в Magento
Система рендеринга в Magento
 
course slides -- powerpoint
course slides -- powerpointcourse slides -- powerpoint
course slides -- powerpoint
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
 
John Rowley Notes
John Rowley NotesJohn Rowley Notes
John Rowley Notes
 
Php Training
Php TrainingPhp Training
Php Training
 
PHPTAL introduction
PHPTAL introductionPHPTAL introduction
PHPTAL introduction
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Php
PhpPhp
Php
 

Recently uploaded

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 

Recently uploaded (20)

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 

Introduction To Lamp

  • 1. Muhammad Abdur Rahman AdnaN jhoroTEK.com [email_address]
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.  
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. A PHP scripting block starts with <?php and ends with ?> . A scripting block can be placed anywhere in HTML. <html> <!-- hello.php COMP519 --> <head><title>Hello World</title></head> <body> <p>This is going to be ignored by the PHP interpreter.</p> <?php echo ‘<p>While this is going to be parsed.</p>‘; ?> <p>This will also be ignored by PHP.</p> <?php print( ‘ <p> Hello and welcome to <i>my</i> page!</p> ' ) ; ?> <? php // This is a comment /* This is a comment block */ ?> </body> </html> The server executes the print and echo statements, substitutes output. print and echo for output a semicolon (;) at the end of each statement (can be omitted at the end of block/file) // for a single-line comment /* and */ for a large comment block.
  • 17.
  • 18. Arrays An array in PHP is actually an ordered map. A map is a type that maps values to keys. <?php $arr = array(&quot;foo&quot; => &quot;bar&quot;, 12 => true); echo $arr[&quot;foo&quot;]; // bar echo $arr[12]; // 1 ?> key = either an integer or a string. value = any PHP type. <?php $arr = array(5 => 1, 12 => 2); $arr[] = 56; // the same as $arr[13] = 56; $arr[&quot;x&quot;] = 42; // adds a new element unset($arr[5]); // removes the element unset($arr); // deletes the whole array $a = array(1 => 'one', 2 => 'two', 3 => 'three'); unset($a[2]); $b = array_values($a); ?> can set values in an array unset() removes a key/value pair *Find more on arrays array_values() makes reindex effect (indexing numerically) Arrays An array in PHP is actually an ordered map. A map is a type that maps values to keys. array() = creates arrays <?php $arr = array(&quot;foo&quot; => &quot;bar&quot;, 12 => true); echo $arr[&quot;foo&quot;]; // bar echo $arr[12]; // 1 ?> <?php array(5 => 43, 32, 56, &quot;b&quot; => 12); array(5 => 43, 6 => 32, 7 => 56, &quot;b&quot; => 12); ?> if no key , the maximum of the integer indices + 1. if an existing key , its value will be overwritten. <?php array(5 => 43, 32, 56, &quot;b&quot; => 12); array(5 => 43, 6 => 32, 7 => 56, &quot;b&quot; => 12); ?> if no key , the maximum of the integer indices + 1. if an existing key , its value will be overwritten. <?php $arr = array(5 => 1, 12 => 2); $arr[] = 56; // the same as $arr[13] = 56; $arr[&quot;x&quot;] = 42; // adds a new element unset($arr[5]); // removes the element unset($arr); // deletes the whole array $a = array(1 => 'one', 2 => 'two', 3 => 'three'); unset($a[2]); $b = array_values($a); ?> can set values in an array unset() removes a key/value pair *Find more on arrays array_values() makes reindex effect (indexing numerically)
  • 19.
  • 20. Conditionals: if else Can execute a set of code depending on a condition <html><head></head> <!-- if-cond.php COMP519 --> <body> <?php $d=date(&quot;D&quot;); if ( $d==&quot;Fri&quot; ) echo &quot;Have a nice weekend! <br/>&quot;; else echo &quot;Have a nice day! <br/>&quot;; $x=10; if ($x==10) { echo &quot;Hello<br />&quot;; echo &quot;Good morning<br />&quot;; } ?> </body> </html> if ( condition ) code to be executed if condition is true ; else code to be executed if condition is false ; date() is a built-in function that can be called with many different parameters to return the date (and/or local time) in various formats In this case we get a three letter string for the day of the week.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31. <?php session_destroy(); ?> NOTE: session_destroy() will remove all the stored data in session for current user. Mostly used when logged out from a site. <?php unset($_SESSION['views']); ?> unset() removes a data from session
  • 32.
  • 33.
  • 34.