When you learn PHP, you cannot go far without learning PHP syntax. Syntax is simply the way PHP keywords and PHP functions are set together to create a program that the computer will use for instructions. In this small guide, we take a look at the basics of PHP syntax. Note that this syntax cannot be separated from the use of keywords and functions. Those two put together according to the syntax rules of the language form what is commonly called PHP code.
Properly Bracketed PHP Code
PHP is an interpreted language. This means that all the PHP code you write is passed to a separate program that interprets it into something that the computer will comprehend. This makes PHP programs easier to write but a bit slower than some other languages that are compiled, or interpreted, before they are executed.
Since PHP is interpreted, any PHP script or program must begin with a declaration of itself as PHP code. To do this, we use angled brackets, question marks, and the word 'php' as follows:
<?php your program goes here
It is important to remember both sets of braces, especially if you embed your PHP script into another file format (e.g., the HTML of a web page).
Semicolon as the Line Delimiter
Every form of expression uses something called delimiters. A delimiter is simply what separates the several pieces into distinguishable parts. In written languages, the most common word delimiter is the space. In English, the sentence delimiter is the period or full stop ('.'). Likewise, in programming, the computer needs a way of knowing that the end of the line has been reached. In PHP, the line delimiter is the semicolon (';').
An example of a PHP statement reads:
echo "Hello, world!";
and results in the following output when run through the PHP interpreter:
Every command or operation unit in PHP must be punctuated with a semicolon (';'). If a line is not terminated with a semicolon, the PHP interpreter will try to take the everything between the preceding semicolon and the next semicolon, or the end of the file, and evaluate it as a single line. This frequently results in PHP errors and blank output.
Get Ubuntu Linux: Download, Request, or Order Ubuntu Ubuntu can be downloaded or ordered and is available in a couple of versions: 6.06 (Dapper Drake) and 7.04 (Feisty Fawn). Which you use depends on the software you need. This page shows you from where you can download, request, or buy Ubuntu.
Ubuntu vs Windows Vista Ubuntu had many Windows Vista features almost a year before Microsoft released it. Here is how Ubuntu compares to Windows Vista.
Resizing a Windows Installation Resizing a Windows installation is easy with the Ubuntu installer. Installing Ubuntu in parallel to a Windows installation is called 'dual booting' and is a good idea. Here is how to do it.
A Brief History of Ubuntu Ubuntu's history started with Debian GNU/Linux but has since outgrown it. Here is a brief look at Ubuntu's past and how things stand today.
Booting Windows Instead of Ubuntu by Default Grub boots Ubuntu by default. But if you want to make Windows your default operating system without losing Ubuntu, all you need do is change a number in Grub's configuration file. Here is how.
A Primer for Installing Ubuntu Installing Ubuntu should be as easy as possible, and the best guides for this are provided here at Easy Ubuntu Linux. But all the online resources in the world do not help you offline. For this reason, we are providing this PDF primer to help you install Ubuntu.
Image Handling With Ubuntu Ubuntu's image handling surpasses those of other operating systems. Whether you just need to look at your pictures or create first-rate graphics, Ubuntu offers a program to meet your needs.
Photo Editing With the GIMP Ubuntu comes with the GIMP already installed. Here is a brief tutorial on how to edit photos with the GIMP.
Configure Apache Web Server on Ubuntu Apache is a web server available for Ubuntu. With it you can serve web pages from a computer. Here is how to setup Apache as a web server on Ubuntu.
Apache Web Server Configuration on Ubuntu Apache on Ubuntu is a web server that enables you to serve web pages. How well those web pages are served depends on the configuration you use. Here is detailed information on the default configuration of the Apache web server on Ubuntu.
Reading the php.ini File from Ubuntu PHP is one of the web's main languages for development. Understanding how to configure PHP
allows you to create web pages
dynamically on Apache.
The Easy Ubuntu Blog Ubuntu is not always easy. But Easy Ubuntu Linux helps make it that way. Keep it easy with the Easy Ubuntu blog.
Installing a LAMP Server on Ubuntu A LAMP server is one of the most pervasive types of servers on the Internet, but many people find installing LAMP servers difficult. Here is how to install a LAMP server on Ubuntu.
Installing Samba on Ubuntu Samba is the main Ubuntu file sharing server. It allows you to share files with others from your computer. Here is how to use Ubuntu to share files with Samba.
Configuring Samba on Ubuntu I Samba is a file sharing server for Ubuntu Linux. It allows filesharing with others from your computer. This guide shows how to configure Samba on Ubuntu.
Configuring Samba on Ubuntu II Samba is a file sharing server for Ubuntu Linux. It allows filesharing with others from your computer. This is the second page of a guide that shows how to configure Samba on Ubuntu.
Configuring Samba on Ubuntu III: [globals] Samba is a file sharing server for Ubuntu Linux. The [globals] header is part of the Samba configuration file. This guide shows how to configure the [globals] section of the Samba configuration on Ubuntu.
Configuring Samba on Ubuntu IV: [homes] Samba is a file sharing server for Ubuntu Linux. The [homes] header is part of the Samba configuration file. This guide shows how to configure the [homes] section of the Samba configuration on Ubuntu.
Configuring Samba on Ubuntu V: [printers] Samba also functions as a printer managing server for Ubuntu Linux. The [printers] header is part of the Samba configuration file. This guide shows how to configure the [printers] section of the Samba configuration.
Resizing a Windows Installation: A Caution Resizing a Windows installation is easy with the Ubuntu installer. Installing Ubuntu in parallel to a Windows installation is called 'dual booting' and is a good idea. Here is how to do it.
Credit Card Validation Before Processing Processing credit cards is a fundamental process when you do ecommerce on Apache. Here we walk through some of the more common options for credit card processing on Ubuntu.
Credit Card Processing Choices Processing credit cards is a fundamental process when you do ecommerce on Apache. Here we walk through some of the more common options for credit card processing on Ubuntu.
Apache Web Hosting Apache is the main web server provided by web hosting companies. Here are recommendations on which Apache web hosting company to use for your Apache web host.
Linux Notebooks Linux notebooks are not as rare as they once were. It is nonetheless possible to buy a notebook and find that you cannot install Linux on it. Here is a series of guides for how to install Linux on different notebooks.
PCI DSS - What is PCI DSS PCI DSS is one of the most important elements of e-commerce. Even if you run your own credit card processing business, you would be forgiven for wondering 'What is PCI DSS?'. This cryptic abbreviation is explained here.
Sudoers - Registering Users in the Sudoers File Sudoers are those users who can gain administrative access to the system. Their names are listed in the sudoers file. Here is how to be so registered if your username is not in the sudoers file.
Sign Up for Gmail Sign up for Gmail and get several benefits for free. Here is how to sign up for Gmail for free.
Email Solutions on Ubuntu Linux Email solution on Linux vary according to how much control and accessibility you want to have. Here we see what is available
for email solutions under Ubuntu Linux.
Install Ubuntu 10.04 (Lucid Lynx) Install Ubuntu 10.04 (Lucid Lynx) with minimal fuss. Some choices in the installation process are better than others, and this installation guide will help you to install Ubuntu 10.04 (Lucid Lynx) with ease.
OpenOffice Writer OpenOffice Writer is the wordprocessing application of the OpenOffice office suite of productivity applications. Here are the basics of using OpenOffice Writer.
Unless otherwise stated, all material contained on this website is
copyrighted to Easy Ubuntu Linux.com. All rights are reserved. All
content is provided AS IS without any warranty of any kind for any
If you have a question or comment about Ubuntu or this site,
please send email to 'webmaster (at) easy-ubuntu-linux.com' (remove
single quotes and replace "@" for " (at) ").