PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. Alternative to competitors such as Microsoft's ASP. What is PHP? PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use. What is a PHP File? PHP files can contain text, HTML, CSS, JavaScript, and PHP code PHP code are executed on the server, and the result is returned to the browser as plain HTML PHP files have extension ".php" What Can PHP Do? PHP can generate dynamic page content PHP can create, open, read, write, delete, and close files on the server PHP can collect form data PHP can send and receive cookies PHP can add, delete, modify data in your database PHP can be used to control user-access PHP can encrypt data A PHP script is executed on the server, and the plain HTML result is sent back to the browser. Basic PHP Syntax A PHP script can be placed anywhere in the document.A PHP script starts with <?php and ends with ?>:<?php// PHP code goes here?>The default file extension for PHP files is ".php".A PHP file normally contains HTML tags, and some PHP scripting code. PHP Case Sensitivity In PHP, all keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive.In the example below, all three echo statements below are legal (and equal): Example <!DOCTYPE html><html><body><?phpECHO "Hello World!<br>";echo "Hello World!<br>";EcHo "Hello World!<br>";?></body></html>However; all variable names are case-sensitive. In the example below, only the first statement will display the value of the $color variable (this is because $color, $COLOR, and $coLOR are treated as three different variables): Example <!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> Run example »
Möchten Sie kostenlos Ihre eigenen Notizen mit GoConqr erstellen? Mehr erfahren.