|
Jan
24
2009
|
|
Belajar PHP |
Mari kita belajar bahasa Pemrograman PHP.
Pertama kali yang harus di Install adalah program PHP nya sendiri, atau saya biasa bilang (PHP Console). Master PHPnya dapat di download pada situs http://www.php.net/downloads.php, situs tersebut selalu update versi terbaru.
Tata cara Instalasi biasanya selalu ada di dalam package download Master PHP.
Disini saya menggunakan Operating System Windows XP.
Setelah terInstal, kita test dengan pakai Command Prompt.
Misalnya, Directory install ada di C:\PHP\ , kita lakukan test memunculkan versi dari PHP, seperti dibawah ini ;
C:\PHP>php -v
PHP 5.2.4 (cli) (built: Aug 30 2007 07:06:31)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
Untuk Menampilkan attribute dari command php, gunakan command php –help
C:\PHP>php --help
Usage: php [options] [-f] <file> [--] [args...]
php [options] -r <code> [--] [args...]
php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
php [options] -- [args...]
php [options] -a
-a Run interactively
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse and execute <file>.
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-r <code> Run PHP <code> without using script tags <?..?>
-B <begin_code> Run PHP <begin_code> before processing input lines
-R <code> Run PHP <code> for every input line
-F <file> Parse and execute <file> for every input line
-E <end_code> Run PHP <end_code> after processing all input lines
-H Hide any passed arguments from external tools.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
args... Arguments passed to script. Use -- args when first argument
starts with - or script is read from stdin
--ini Show configuration file names
--rf <name> Show information about function <name>.
--rc <name> Show information about class <name>.
--re <name> Show information about extension <name>.
--ri <name> Show configuration for extension <name>.
Dengan demikian PHP sudah dapat digunakan.
Tahapan I
Kita coba jalankan PHP file script,
Untuk penulisan syntac script PHP selalu diawali dengan <? atau <?php dan diakhiri dengan ?>.
Misalnya kita buat file coba.php
-
echo "Belajar cetak PHP";
Jalankan dengan PHP di command prompt;
C:\PHP>php coba.php
Belajar cetak PHP
C:\PHP>
Tahapan II
Tahapan II kita coba dengan memberikan masukan dari command prompt.
Nama File Coba2.php
Jalankan dengan PHP :
C:\PHP>php coba.php
Namamu Siapa: Socode
Namamu , Socode! Kan
C:\PHP>
Lanjut dengan mengkombinasikan masukan dengan kondisional.
Nama File coba3.php
Jalankan dengan PHP :
C:\PHP>php coba3.php
Angka 1 : 1
Angka 2 : 4
Angka 1 dan 2 Tidak sama,
yaitu angka 1= 1 dan angka 2= 4
Untuk Sementara Belajar cukup sampai disini.
Segera Update untuk tahap Selanjutnya.
Terimakasih.

Leave a Reply