Chapter 8 - Conventions Used in this Book

There are several conventions used through this book.

Code is indented 2 spaces

Usually, I indent code 4 spaces but since this book is available in a variety of eBook formats some of the smaller screens have horizontal space at a premium.

1 for ($i = 0; $i < 10; $i++)
2 {
3   echo "I can count to ", $i, "\n";
4 }

This is a tip

It is used to highlight a particularly useful piece of information.

This is a warning

It is used to warn you about something to be careful of.

This is an information block

Used to reiterate an important piece of information

This is something to do

When there’s code, or other actions you should take, it’s always proceeded by this symbol.

Trailing ?> is used when opening tag is used.

When coding, I always drop the trailing ?> in a file. But the editor I’m writing this book in makes everything look wonky when I do it. So, within this book, if I open a PHP block with the PHP tag, I always close it in the code too. For example:

1 <?php
2 class SomethingOrOther {
3     private $dummy;
4 }
5 ?>

PHP Opening and Closing Tags

In the code examples sometimes the opening PHP tag (<?php) is used when it’s not needed (such as when showing a portion of a file.) Sometimes the closing PHP tag (‘?>’) is used when it’s not needed.

1 <?php
2   function somethingOrOther()
3   {
4     $this->callSetup();
5   }
6 ?>

With real PHP Code I always omit the closing tag at the end of the file. I’ll leave it to you to determine whether or not the tags are needed. Be aware the opening and closing tags in the code examples should not be taken verbatim.

What OS am I using?

I’m writing this manual, the code, etc., using Linux Mint 14 which based on Debian and Ubuntu. It’s basically the same as Ubuntu 12.10.