Tutorial
Tutorial PHP » Sintaxa PHP
Un script PHP este executat pe server, iar rezultatul HTML simplu este trimis înapoi în browser.Sintaxa PHP de baz?.
Un script PHP poate fi plasat oriunde în document. Un script PHP începe cu Php ?i se termin? cu ?>:<?php
// codul php se afla aici
?>
Extensia implicit? pentru fi?ierele PHP este „.php”.
În mod normal, un fi?ier PHP con?ine etichete HTML ?i unele coduri de scripturi PHP.
Mai jos, avem un exemplu de fi?ier PHP simplu, cu un script PHP care folose?te func?ia PHP încorporat? „echo” pentru a scoate textul „Buna Romania” pe o pagin? web:
Exemplu:
În mod normal, un fi?ier PHP con?ine etichete HTML ?i unele coduri de scripturi PHP.
Mai jos, avem un exemplu de fi?ier PHP simplu, cu un script PHP care folose?te func?ia PHP încorporat? „echo” pentru a scoate textul „Buna Romania” pe o pagin? web:
Exemplu:
<!DOCTYPE html>
<html>
<body>
<?php
echo "Buna Romania";
?>
</body>
</html>
Sensibilitate la cazurile PHP
În PHP, NU exist? cuvinte cheie ( if, else, while, echo, etc.), clasele, func?iile ?i func?iile definite de utilizator sunt sensibile cu majuscule.
În exemplul de mai jos, toate cele trei declara?ii echo de mai jos sunt egale ?i legale:
Exemplu:
Sintaxa pentru comentarii cu mai multe linii:
<!DOCTYPE html>
<html>
<body>
<?php ECHO "Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";
?>
</body>
</html>
Privi?i exemplul de mai jos; numai prima declara?ie va afi?a valoarea variabilei $color! Acest lucru se datoreaz? faptului c? $color, $COLOR ?i $coLOR sunt tratate ca trei variabile diferite:
Exemplu
<!DOCTYPE html>
<html>
<body>
<?php
$color = "red";
echo "My car is ". $color ."<br>";
echo "My house is ". $COLOR ."<br>";
echo "My boat is ". $coLOR ."<br>";
?>
</body>
</html>
Online Editor
This tool makes it easy to create, adjust, and experiment with custom colors for the web.
HTML Templates

Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.
CSS HTML Layout

Find here examples of creative and unique website layouts.
Free CSS HTML Menu

Find here examples of creative and unique website CSS HTML menu.