In this lesson our instructor talks about basic PHP syntax. First he discusses PHP delimiters, PHP's configuration, statements, and comments. Then he talks about coding conventions. He ends the lesson with two homework challenges.
There are four valid forms of PHP delimiters: long (<?php, ?>), script
(<script language="php">, </script>), short(<?, ?>), and
The short and ASP-style PHP delimiters are not always available, as they can be
enabled/disabled using php.ini , so they should not be used for portability
The long form delimiters are recommended because they are always available and
are XHTML- and XML-compliant.
php.ini , located in 'php' folder of the XAMPP installation directory,
is the global PHP configuration file that controls how PHP runs on your local
When using XAMPP, Apache must be restarted for changes to php.ini to
The phpinfo() function outputs information about the current PHP
Statements are individual instructions to be executed by PHP and are always
separated by semicolons.
Comments are text added to PHP code that are ignored by the PHP interpreter and
used to aid programmers in understanding the code.
Single line comments and are delimited by either // or #. PHP interprets all text
after these delimiters until either the end of the line or a PHP closing tag is
reached, whichever comes first, as comments.
Multi-line comments are signified to PHP by the start and end delimiters, /* and
*/. All text between this style of comment delimiters is treated as comments.
Care should be taken to avoid the nesting of multi-line comments.
Coding conventions describe a set of rules for how code should be formatted and
written that can only be enforced by the programmer and not by the programming
language. The purpose of coding conventions are to make code easier to read,
understand, maintain, and debug.
Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.