Saturday, October 25, 2008


In the Web application often we need self referencing URL to refer path current Script. Marginally this implementation step can through 2 approach, namely apply superglobal $_ SERVER and function getenv().

echo $_SERVER['PHP_SELF']; echo $_SERVER['SCRIPT_NAME']; echo $_SERVER['REQUEST_URL'] echo getenv['SCRIPT_NAME'] echo getenv['REQUEST_URL']
Different with other element, REQUEST_URL will return query string (if founded. For applied inveterate approach is element PHP_SELF.

Read More “Self-Referencing”  »»

Thursday, October 16, 2008

array base technique

To make easy using array, be better if we comprehend Array Base Technique must be first. Create Array Array in PHP grouped to become two type, indexed and associative. Array Indexed is array who’s the key like in the form of integer, normally started from 0. Array associative used string as key. You Can Create array with two models. Number one uses language construction array() and square bracket sintax.
$arr1 = array(‘a’,’b’,’c’); print_r($arr1); $arr2[] = ‘a’; $arr2[] = ‘b’; $arr2[] = ‘c’; Print_r($arr2);
Create array associative you must do that with same way. But in here you must specified of base key.
$arr3 = array(‘a’ => ‘A’, ‘b’ => ‘B’, ‘c’ => ‘C’); print_r($arr3); $arr4[‘a’] = ‘A’; $arr4[‘b’] = ‘B’; $arr4[‘c’] = ‘C’; print_r($arr4);

Read More “array base technique”  »»

Manipulation String

Operation and manipulation string is a hot topic for programmer. But in fact, manipulation and operation coverage string very wide and do not seldom base on problem domain which faced. Although that if you have experience about fundamental base, we will found solution of the problem. One correct way to starts operation string is comprehended anatomy and also the characteristic first. String Literal String can be specified by three approach
  • single quotation mark
  • double quotation mark
  • syntax here document (heredoc)
$strl = ‘America’; echo ‘Halo $strl’; echo “Halo $strl”; $str2 = << Sintaks heredoc EOQ; Echo $str2;
Double quotation mark and heredoc make result variable interpolation so that both approach tend to farther out compared by single quotation mark.

Read More “Manipulation String”  »»


Class is one of fundamental element OOP (Object Oriented Programming). Class can be illustrated as blueprint or prototype what is applied to create object. Definition Class Class name must be descriptive and better always started with block letters. Name of class better also express the position hierarchy and use underscore as hierarchy winnow.

Form FormUpload //For example file location Form/Db/validator.php Form_Db_validator
Class is defined use apply keyword class who’s followed name of class. Definition of class consist two component, that is declaration class and body class. Declaration class is a first row in class. And minimum defined name class. Body defined after name class and between confine streamer { }
//declaration class Class Form { //body class }

Read More “Class”  »»

Monday, October 13, 2008


Consistency often related to writing standard code program. Of course well founded because writing of consistent code make code program more easily to read and comprehended.. If variable is applied for purpose of similar, better give similar name too. For example, if variable $sum is applied to express an amounts, hence you must to always wear the name. That’s mean don't give different name for purpose of similar, for example $sum, $sumer, $amount. For usage in one block. You can declaration variable with same prefix, for example $sum_data, $sum_max, $sum_min. Though not easy to consistency implementation, we must cope for minimization mistaken of naming.

Read More “Consistency”  »»

Sunday, October 12, 2008

Program Code Format

To make easier program code scanning, do not writing of long code in a line. As solution, program code format by elaborating the parts.
// not like it If ($letter == ‘a’ || $letter == ‘I’ || $letter == ‘u’ || $letter == ‘e’ || $ letter == ‘o’) {$vocal = true;} // like it If ($letter == ‘a’ || $letter == ‘I’ || $letter == ‘u’ || $letter == ‘e’ || $letter == ‘o’) { $vocal = true; }
In addition, better always apply space for neatening program
$name = ‘php’; $category = ‘server-side’; $url = ‘’;

Read More “Program Code Format”  »»

Friday, October 10, 2008

Standard coding

Every programming language always give standards rule for made reference programmer. This thing for created program are consistence and uniform. The example is standard name. In programming, a name is applied to relate identity which for declaration. Related/relevant this matter, there are some base order which truly hardly required to produce a program more interesting. Variable name better use a lower case. If the name consist of some words, disjointed with under line (underscore). For example $name or $name_user. Give name of Constanta is suggested to follow order variable except using all block letters. For Example MAX MAX_DATA or SUM_DATA. Name of function better also relate at naming of variable and hardly suggested that to express a verb or action, for example get_data(), set_data(), or print(data).

Read More “Standard coding”  »»

Thursday, October 9, 2008

What is PHP ?

PHP? Maybe many more question in friends of hearing word PHP. PHP is a script which one with HTML dan stay at server (server side HTML embedded scripting). With this PHP You can create immeasurable application base on the web, start from simple web page until the application of complicated requiring connection to database. Until now, many databases which have been supported by PHP and possibilities will continuously increase. the database is :

  • dBase
  • DBM
  • FilePro
  • mSQL
  • MySQL
  • ODBC
  • Oracle
  • Postgres
  • Sybase
  • Velocis
Besides of that, PHP also support connection with protocol IMAP, SNMP, NNTP dan POP3. History PHP PHP first time made by Rasmus Lerdorf in the year 1995. At the moment called FI (Form Interpreted). PHP is a group of script which applied to data form processing from the web. Growth from here Rasmus discharge the source of code and give a name him PHP/FI, at the time elongation from PHP/FI is Personal Home Page/Form Interpreter. With this release of source code become open source, many programmers interesting to follow develop PHP. At November 1997, release PHP/FI 2.0. At this release, implementation on C. On this release also figured extensions modules increasing ability of PHP/FI. In the year 1997, a company called Zend, rewrite PHP become more clean, quick and better. Then at June 1998 the company release new of PHP and give a name PHP 3.0. in the middle of the of 1999, Zend release PHP 4.0. PHP 4.0 is PHP version which at most weared. This version many weared because this versions can be use to build the web application are complex but remain to have a speed of high stabilities and processes. At June 2004, Zend release PHP 5.0. This version is recent version from PHP. In this version, core from PHP experience change of large. In this version also defined by new object-oriented programming model.

Read More “What is PHP ?”  »»