Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

PHP Introduction

Web Programming Fundamentals w/ PHP
by

Philip Heimer

on 13 April 2015

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of PHP Introduction

Dynamic Web Systems
HTTP Request
Managing the PHP server
There are several ways to run a PHP server, but we recommend XAMPP.

Writing PHP code
PHP Introduction
PC
Web Server
Database
request
web page from server..
response
(HTML)
SELECT * from tableXYZ
SQL result
processing PHP code.. and adds database
results to the webpage,
- then sending the results back in HTML format which is readable to the client
Web server listening to port 80, 443
If the site is built with php, it will start processing that code.
The php-code might tell the server to make one or several database requests to fetch data...
PHP Launch Pad
Work locally...
http://www.apachefriends.org/index.html
You also have a public server area at ddi.hh.se or ideweb2.hh.se - See Blackboard for more info

FTP:
Hostname: ddi.hh.se / ideweb2.hh.se
Connection type: SFTP
Port: 20022

While you run a web-service on your home system.. make sure port 80 and 443 are accessible! Services.msc is your friend.
<?php

$content = <<<END
<div>This is some content.</div>
END;

echo $content;

?>
heredoc
includes
variables
operators
functions and parameters
coffee
if and else
arrays
loops
...and examples from lab 1
ONLINE MATERIAL
SEE YOU IN LAB
Publish remotely...
Recommended FPT Client: https://filezilla-project.org/
"Personal Home Page Tools"
became PHP
Rasmus Lerdorf 1994
"PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP is now installed on more than 244 million websites and 2.1 IP-addresses"
http://php.net/usage.php
http://builtwith.com/
What is this site built with?!...
PHP Rocket
PHP Rocket
ASP.NET INFIDEL
PHP vs. Python vs. Ruby vs. Java vs. .NET
Rasmus Lerdorf on PHP and the Open Souce Community
=>
/*embedding css.. */

<style type="text/css">
body { text-align: center;}
</style>
<?php ....

?>

/* including bootstrap css */

<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<?php ....

?>


/* template.php-file */

<?php

$header = <<<END
<header style="font-size:x-large">This is some header content</header>
END;
$footer = <<<END
<footer style="position:absolute; bottom:0; font-size:x-large">This is some footer content</footer>
END;

$navigation = <<<END
<nav style="display: inline-block">
<a href="#a">Link1</a>
<a href="#a">Link2</a>
<a href="#a">Link3</a>
<a href="#a">Link4</a>
<a href="#a">Link5</a>
</nav>
END;

?>

/* variabler */

$xnumber = 5;
$xtext = "String-text";
$xbool = true;

echo $xnumber * 10;
echo "<br>" . $xtext . " and some other text";
echo "<br>" . $xbool;

if($xbool)
echo "Yes its true!";



/* if or else */

$xbool = false;

if ($xbool == true)
{
echo "It is true!";

}
else
{
echo "..or is it?";
echo "...no it's not";
}



/*funktioner...*/

function myFunction($value){

if ($value < 55)
{
echo ("You're young!<br>You're young!");
}
else
echo "You are very old!";

}

myFunction(50);


<?php


function multiplicera($xx)
{
echo $xx * 99;
}

multiplicera(10);

?>


/* Indexed Arrays */


<?php

/*Arrays*/

<?php

/*Loop through array...*/

$bob = array("I"," am");
$arrcount = count($bob);

for($i = 0;$i<count($bob); $i++)
{
echo $bob[$i];
}

?>


/* Assosiative array */

<?php

$age = array(
"Bob" => 45,
"Geldof" => 75,
"Stina" => 99,
);

echo $age["Geldof"];

?>

/*Loop through assoc */

<?php

$age = array(
"Bob" => 45,
"Geldof" => 75,
"Stina" => 99,
);

foreach($age as $x=>$x_value)
{
echo $x_value;
}

?>



<?php

$age = array(
"Bob" => 45,
"Geldof" => 75,
"Stina" => 99,
);

foreach($age as $x=>$x_value)
{
echo $x . " is " . $x_value . "<br>";
}

?>
Full transcript