php

Post on 10-May-2015

267 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

PHP

What is HTML?

HyperText Markup Language (HTML) is the main markup language for web pages

Why HTML?

What is CSS?

Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of HTML

h1 { color: white; background-color: orange; } h2 { color: white; background-color: green; }

Why CSS?

Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation semantics (the look and formatting) of HTML

h1 { color: white; background-color: orange; } h2 { color: white; background-color: green; }

What is Javascript?

JavaScript is a scripting language

function sum() {

var i, x = 0; for (i = 0; i < arguments.length; ++i) { x += arguments[i]; } return x; }

Why Javascript?

HTML provides only one way communication

Hey, are you

there?

Why the hell don’t you talk to

me?

HTML is static and boring.

With pure HTML web pages, the server simply serves up static HTML that can only display content.

Okay, PHP brings web pages to life

With a little help from the server

#webpage

#static_page

#dynamic_page

#form

PHP Syntax <html> <body> <?php echo "Hello World"; ?> </body> </html>

String <?php $txt="Hello World"; echo $txt; ?> Concatenation Operator <?php $txt1="Hello World!"; $txt2="What a nice day!"; echo $txt1 . " " . $txt2; ?>

strlen() strlen("Hello world!")

strpos strpos("Hello world!","world");

Function function functionName() { echo(“Hello world”); }

Use PHP to access form data

PHP scripts must live on a server

A variable is a container that you can store data in.

Arithmetic Operators

Assignment Operators

Comparison Operators

Logical Operators

If … else

Array Numeric Arrays $cars=array("Saab","Volvo","BMW","Toyota");

Associative Arrays $ages = array("Peter"=>32, "Quagmire"=>30, "Joe"=>34);

For loops for ($i=1; $i<=5; $i++) { echo "The number is " . $i . "<br />"; }

top related