Home
XHTML
CSS
PHP
MySQL
SEO
JavaScript
Computer Basics
Number Systems
LINUX


PHP Tutorials

PHP | Values | Operators | Functions | Arrays | Forms | Sessions-Cookies | Classes

PHP is a server and scripting language for processing dynamic webpages. A PHP file is any plain text file named with a .php extension. The standard XHTML tags are required when PHP and XHTML are coded together.

A PHP file can have one or more scripts. The  <?php  tag opens a script and  ?>  closes a script. A script is a series of commands. A command defines a statement. A statement generates an action. The  ;  semicolon declares the end of a statement. Multiple statements generated as a block are declared within  { }  curly brackets...

<html>
<head>

<title>Title of Webpage</title>

</head>
<body>

<?php

command statement;
command {statement, statement;}

?>

</body>
</html>





Comments can be added in PHP for notes or reminders. Comments are visible in the source code, but not the browser...

<?php

// This is how to code a single line comment in PHP

# This is also how to code a single line comment in PHP

/* This is how to code a single line
   or multiple line comment in PHP */

?>





Commands

A variable, also known as a scalar, is a command that stores a single value. Variable names are created and case-sensitive, but must be declared with the  $  dollar sign and only include letters, numbers, and underscores. A number is not allowed as the first character. The lowercase or camelCap convention is recommended. A variable is assigned a value with the  =  equal sign as the assignment operator.

The echo command outputs data to a browser...

<?php

$variableName=1;

echo $variableName;

?>

The output to the browser is...

1




Various other commands are used in PHP. An array is like a variable, but stores multiple values. A function is like a command, but has more complex features.



Tutorials for installation and configuration of PHP are on the Install page.




SEO Vancouver, Washington
SEO Portland, Oregon
Website Design Vancouver, Washington