Rabu, 05 Maret 2008

Hello world

How to began study on php (PHP Hypertext Processor).
PHP always began with sign
The first lesson is display 'hello word' in the browser.

Code:
echo 'hello world';
?>

save this file in the web root with file name hello.php(sample). and call in the browser.
Similar with this code is

print 'hello world';
?>

we could use a variable to display in the browser. Variable always began with $ sign.
$words='Heloo world';
echo $words;
?>

$words='Heloo world';
$new_words=' have a nice day';
$words =$words.$new_words
echo $words;
?>
will oputput helloo world have a nice day
or that code coul be write
$words='Heloo world';
$new_words=' have a nice day';
$words .=$new_words
echo $words;
?>

that meaning .= is adding $words with $new_words

Tidak ada komentar: