Membuat aplikasi dengan php

Post on 30-Jun-2015

776 views 16 download

Transcript of Membuat aplikasi dengan php

MEMBUAT APLIKASI DENGAN PHP

Agus SupriatnaMicrosoft Certified Professional

Developerwww.asupna.com

@agusSuparkasupriatna@teken.co.id

PURPOSE

Dengan pesatnya perkembangan Internet dan World Wide Web ada peningkatan permintaan untuk pengembang dengan kemampuan untuk melakukan manipulasi Web data lebih maju.

Siswa yang terlibat dalam pengembangan Web statis membutuhkan teknik untuk memanipulasi konten Web sehingga web menjadi dinamis.

Tujuan dari program PHP adalah alat dan teknik untuk mengembangkan lebih dinamis Web berbasis aplikasi, dengan manipulasi data yang disimpan dalam database online

CONTENT

1. Introduction

2. Working with HTML

3. Getting Started With Variables

4. Operators

5. Control Structure

6. Arrays in PHP

7. Functions

8. Web Application

1. INTRODUCTION

PHP (Personal Home Page Tools) created by Rasmus Lerdorf In 1994, umumnya digunakan untuk:

1. Melakukan fungsi sistem: membuat, membuka, membaca dari, menulis, dan menutup file di sistem, menjalankan perintah sistem, membuat direktori, dan mengubah hak akses.

2. Mengumpulkan data dari bentuk: menyimpan data ke file, mengirim data melalui e-mail, mengembalikan data dimanipulasi untuk pengguna.

3. Akses database dan menghasilkan konten on-the-fly, atau membuat antarmuka Web untuk menambahkan, menghapus, dan memodifikasi elemen-elemen dalam database Anda.

4. Mengatur cookie dan variabel akses.

5. Otentikasi pengguna PHP untuk membatasi akses ke bagian situs Web Anda.

6. Membuat gambar on-the-fly.

7. Enkripsi data.

INSTALL

Xampp (Apache Web Server, PHP, Mysql)

Front end for the MySQL database server

PHP Editor Eclipse, Notepad++

2. WORKING WITH HTML<html>

<head><title>PHP Test</title></head>

<body>

<?php echo '<p>Hello World Saya Menggunakan PHP</p>'; ?>

<table>

<tr> <th>Nama</th><th>Umur</th></tr>

<tr><td>Bagus</td><td>17 tahun</td></tr>

</table>

</body>

</html>

2. WORKING WITH HTML FORM<form action=“handleForm.php" method="post">

<p>Nama: <input type="text" name=“Nama" /></p>

<p>Umur: <input type="text" name=“Umur" /></p>

<p>Komentar: <textarea rows=5 cols=40 name=“Komentar”> </textarea>

<p><input type="submit" name=“Simpan” value=“simpan”/>

<input type=“reset" name=“Clear” value=“Hapus Form”/>

</p>

</form>

COMMENTING YOUR CODE

1. HTML comments <!—and —>tags.

<!— logo graphic goes here —>

2. PHP comments // ; # ; /* and */

// this is a comment in PHP code

# This is shell-style style comment

/* This begins a C-style comment that runs

onto two lines */

3. GETTING STARTED WITH VARIABLES1. Variable Scalar, berisi satu nilai dalam satu waktu

• Integers

• floating poin numbers (floats/doubles).

• Strings.Text and/or numeric yg ada diantara double quotes (" ") or single quotes (' ')

2. Variable Arrays, berisi sejumlah nilai dan array lain sehingga membentuk multidimensi array

3. HTML Variabel, variable yg didapat dari HTML form atau URL link

4. Supperglobal Variable, variable yg sudah ada di php engine

VARIABLE SCOPE1. Sigle Scope 2. Global Scope dan Local Scope

<?phpvar $r = 'I am r.'; class foo { var $bar = 'I am bar.'; var $arr = array('I am A.', 'I am B.', 'I am C.');}$foo = new foo();$bar = 'bar';$baz = array('foo', 'bar', 'baz', 'quux');echo $foo->$bar . "\n";echo $foo->$baz[1] . "\n";?>

SUPERGLOBAL VARIABLES

$GLOBALS

$_SERVER

$_GET

$_POST

$_FILES

$_COOKIE

$_SESSION

$_REQUEST

$_ENV

4. OPERATORS

Assignment Operator : =, += , -= , and .=

Arithmetic Operator: Addition(+), subtraction(-), multiplication(*), division(/), modulus(%)

Comparison Operator equal to (==), not equal to (!=), greater than (>), less than(<), greater than or equal to (>=), less than or equal to (<=)

(&&) and; (||) or ; NOT (!).

5. CONTROL STRUCTURE

if

else

elseif/else if

while

do-while

for

foreach

break

continue

switch

declare

return

require

include

require_once

include_once

goto

ARRAYS IN PHP<?php

$array = array(

"foo" => "bar",

"bar" => "foo",

100 => -100,

-100 => 100,

);

var_dump($array);

?>

count(), is_array(), explode(), implode(), split(), preg_split(), unset() Isset()print_r()var_dump()

7. FUNCTIONS

function function_name($arg_1, $arg_2, ..., $arg_n){code_line1;code_line2;code_line3;return ($value); //stops execution of the function and returns its argument as the value at the point where the function was called.}

8. WEB APPLICATION

1. Database MySQL

2. Creating and Populating Database

3. User Authentication

BEST PHP FRAMEWORKS FOR 2014

LINK

http://php.net

http://www.phpclasses.org

http://www.w3schools.com/

https://www.colorschemer.com/online.html