Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 1

Creating PHP Pages

One of the benefits of using PHP is that the language is relatively simple and straightforward
(mudah). As with any computer language, there is usually more than one way to perform the same
task (tugas). You can research different ways to make your code more efficient once you feel
comfortable writing PHP programs. But for the sake (demi) of simplicity (kesederhanaan), we cover
only the most common uses, rules, and functions of PHP.
PHP code is denoted (dilambangkan) in the page with opening and closing tags, as follows:
<?php
?>
Generally speaking, PHP statements end with a semicolon:
<?php
$num = 1 + 2;
echo $num;
?>
You can add comments in your program by using double forward slashes (//) for one-line
comments or /* to mark the start and */ to mark the end of a comment

that may extend

(memperpanjang) over several lines.


What Makes a Great Program?
Truly professional code follows three general guidelines (pedoman umum):

Consistency
Frequent comments
The use of line numbers

why Should You care about What Your Code Looks Like?
Its important to follow good coding practices for three reasons:

For effieciency
For debugging
For future expansions and modifications

The PHP statement echo, seen in the example that follows, is one of the most commonly used PHP
functions and one that you will undoubtedly become intimate with. It is used to send text (or
variable values or a variety of other things) to the browser.

You might also like