introduction to php n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Introduction to PHP PowerPoint Presentation
Download Presentation
Introduction to PHP

Loading in 2 Seconds...

play fullscreen
1 / 12

Introduction to PHP - PowerPoint PPT Presentation


  • 121 Views
  • Uploaded on

Introduction to PHP. Data type Operators Statements. Data Type. Integer 4 bytes 1,2, 56, -12 Float 1.23, 3000.45 String “11AA”, “rrrr” Boolean ?? 0, 0.0, “”: false Others: true. Datatype. integer double string array object class unknown type. Variables. Case-sensitive

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Introduction to PHP' - dom


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
introduction to php

Introduction to PHP

Data type

Operators

Statements

data type
Data Type
  • Integer
    • 4 bytes
    • 1,2, 56, -12
  • Float
    • 1.23, 3000.45
  • String
    • “11AA”, “rrrr”
  • Boolean ??
    • 0, 0.0, “”: false
    • Others: true
datatype
Datatype
  • integer
  • double
  • string
  • array
  • object
  • class
  • unknown type
variables
Variables
  • Case-sensitive
  • $VariableName
    • $i, $moon,
  • Build-in function is not case-sensitive
    • echo() ?? ECHO()
  • Declaration
    • $num=10;
    • $num=10.0
    • $num=“OOOO”
    • Ex: $k=10; $ks=“112HHHH”;
      • $addv=$k+$ks; ??
      • $c=$a+$b;
constant
Constant
  • Ex:
    • PI=3.14;
  • Syntax
    • Define(“PI”,3.14)
  • PI=39.34;
  • PI=$a+$b;
build in functions
Build-in Functions
  • Gettype()
    • $i=30;
    • Echo(Gettype($i)) ??
  • Settype()
    • $a=7.8;
    • Settype($a, “integer”)
struct
Struct
  • Protein ??
    • ID
    • Name
    • AtomNum
    • Type
      • $protein->id
      • $protein->name
      • $protein->atomnum
      • $protein->type
operators
Operators
  • Calculation operators
    • +,-,*,/
    • ++,--
      • $a=10; $a++; /* a=? $a=$a+1;*/
      • $a=10; $b=$a++; /* a=? , b=? */
      • $a=10; $b=++$a; /* a=? , b=? */
  • Boolean
    • >=,<=,!=,>,<
    • && (and) , || (or),
      • $I=10;
      • If (9=$I) echo “11111”;
  • String
    • .
    • $aa=“AAA” . “CCCC”;
  • @
statements 1
Statements-1
  • if ..then .. Else

if ( $SNum > $ENum) $R= ">";

else if ( $SNum < $ENum) $R= "<";

else $R="==";

echo("$SNum $R $ENum");

statements 2
Statements-2
  • Switch

<? $OperType = “a”;

    • Switch { Case.. }

switch ($OperType) {

case "a":

$a = $SNum + $ENum;

echo("$SNum + $ENum = " . $a );

case "s":

$a= $SNum-$ENum;

echo("$SNum - $ENum = " . $a);

break;

}

?>

statements 3
Statements-3
  • Loop (sum 1 to 100)
    • While { … }

$Sum=0;

$i=0;

while ($Snum < $ENum) { // ??

$sum=$sum+$i; // ??

$i++;

} // minimum executing time is 0

    • Do {… } while <<see test1>>

$Sum=0;

$i=$Snum;

do {

$Sum=$Sum+$i;

$i++;

} while ($i<= $Enum); //minimum executing time is 1

statements 4
Statements-4
  • For ( ; ; ) { …}

$Sum=0;

$k=0;

for ($i=$SNum;$i<=$ENum;$i++,$k++)

$Sum=$Sum+$i;