Seven Downloads for Young Web Developers

There are tons of books and tutorials on PHP, MySQL, Zend, and SEO on store shelves. There are even more resources found only on the internet. Sometimes you need something in the middle, content you can download legally and keep handy when you are offline. Below are a few completely free resources that most beginner or intermediate web developers (even if you do it just for yourself) will find useful.


1) PHP Reference: Beginner to Intermediate PHP5

Shameless self-promotion. A reference for many of the functions within PHP that serves as a quick go-to resource for checking syntax and remembering the nuances of many of the functions. It is available as a PHP book you can purchase in print, however the entire book is released under creative commons and available as a PHP reference PDF.

2) Object Oriented PHP Tutorial in PDF

Provided by and Stefan Mischook, this is a PDF version of his article on the topic of object orientated programming in PHP. It gives a conversational explanation to the basics. More information and the OOP PHP PDF is available over on

3) Zend Framework: Surviving the Deep End

The Zend Framework can help developers organize and write more efficient PHP code for large projects and has become one of the top frameworks used online today. From the page…

“The book was written to guide readers through the metaphorical ‘Deep End’. It’s the place you find yourself in when you complete a few tutorials and scan through the Reference Guide, where you are buried in knowledge up to your neck but without a clue about how to bind it all together effectively into an application.”

While available online, there is a link to downloading the PDF version in the bottom right. Check out the Zend Framework survival guide.


4) The Woork Handbook

Another compilation of online articles compiled and organized as an offline document. From the page…

“The Woork Handbook is a free eBook about CSS, HTML, Ajax, web programming, Mootools, Scriptaculous and other topics about web design… directly from Woork!”

This isn’t a full study of any single topic, but is filled with tidbits. Grab the Woork Handbook.

5) Added Bytes Cheat Sheets (formerly ILoveJackDaniels)

While the site’s name has changed, the great resources have not. Cheat sheets are designed to cram (in a useful way) tons of information into the front and back of an 8.5″ x 11″ sheet of paper. There is little excuse for not keeping these handy. Grab the cheat sheets for HTML, CSS, RegEx, Mod_Rewrite, and more.


6) MySQL Manual

All MySQL documentation is available as a downloadable file. Choose from various options for the MySQL documentation.
Editor’s Note: I had trouble finding a good, free, legal resource for MySQL that wasn’t hyper specific and was user friendly. I hope others have suggestions they can leave in the comments.

SEO (Search Engine Optimization)

7) Beginner’s Guide to Search Engine Optimization is an amazing website for learning the complex world of SEO with a very clear, user-friendly tone. Besides that, they offer a bunch of tools for helping your new website get better in the eyes of search engines (aka Google). Available as HTML, MS Word, or an OpenOffice document, you can get a copy of the Beginner’s Guide to Search Engine Optimization over on

Formatting Characters

We’ve all seen them:

  • \n – new line
  • \r – carriage return
  • \t – tab
  • \b – backspace

But many wonder when to use them or more specifically, why they aren’t working as expected. So let’s address the basic usage and rules.

Rule #1: When using a formatting character in your code, it must be within “double quotations” otherwise it will be taken as a literal backslash and letter.

When do you use it? When writing to a file with fwrite() or file_put_contents(), sending a text email with mail(), or when adding formatting to pre-populated data in the form element <textarea>. Now, notice I made no mention of HTML output directly. While it’s possible to represent new line, tab, carriage return in HTML if it is within the preformatted tags <pre></pre>, in most cases these tags are not present and HTML will ignore these formatting characters.

Rule #2: Not all computer systems obey the formatting characters the same. When using \n (new line), also include a carriage return (\r) character.

So what do you do if you have a paragraph, for instance submitted by a <textarea> form, that is preformatted and want it to display in the HTML with the \n (new line) breaks represented? That’s when you toss the string into the function nl2br(), which changes all \n to the xhtml line break <br />.


echo nl2br("Hello\n\rWorld\n\r!!!");



Sprintf() Function Sample

sprintf(formatting, inputs [, …inputs…]

Accepts multiple inputs to be used when specified in formatting

formatting$string, specific formatting string, explained below
inputs $scalar(s) to be formatted

Returns a formatted string formatting, using the inputs to dynamically input their values into the formatted string using a preset set of rules, specified below.

The following is the available nomenclature for the formatting input.

Every time an input is expected to be used and evaluated as part of the formatted string, it is preceded by a percent sign ( % ), followed by the specifiers/rules:
Note: All specifiers, excluding the type specifier, are optional.

  • A sign specifier. Placing a plus sign ( + ) forces negative AND positive signs to be visible (only negative values are specified by default).

  • A padding specifier. The default is a space, and does not need to be specified. A zero ( 0 ) can be used as well without any secondary notation. If any other character is to be used, it should be preceded with a single quote ( ‘ ).

  • An alignment specifier. The default is right-justified (thus padding is placed on the left of the string). Placing a dash/subtract ( – ) will set it to left-justified.

  • A width specifier. This integer determines the minimum length in characters the output should be. When combined with padding, the specified width minus the input’s length determines the number of padded characters that will be added.

  • A precision specifier. A period ( . ) followed by an integer, sets the number of decimal places that should be output for a float. If used on a string, it sets a maximum character limit for the output.

  • A type specifier:

    • % – a literal percent sign, thus would be written %% to display a percent sign in the formatting string

    • b – the input should be an integer, a binary number is the output.

    • c – the input should be an integer between 0-255, representing the ASCII byte-value. The character represented is output.

    • d – the input should be an integer.

    • e – the input is scientific notation.

    • u – the input is an unsigned decimal number.

    • f – the input is a float (locale aware).

    • F – the input is a float (not locale aware).

    • o – the input is an integer, an octal number is the output.

    • s – the input is a string.

    • x – the input is an integer, a hexadecimal number is the output (with lowercase letters).

    • X – the input is an integer, a hexadecimal number is the output (with uppercase letters).


Basic substitution, no optional specifiers

$string = ‘cat’;
$integer = 10;
echo sprintf(“I have %d %s(s)”, $integer, $string);

I have 10 cat(s)

Basic substitution, type specification automatic adjustments

$string = ‘cat’;
$string2 = ’10 blah’;
echo sprintf(“I have %d %s(s)”, $string2, $string);

I have 10 cat(s)

Using the sign specifier

$string = ‘cat’;
$integer = ’10’;
echo sprintf(“Dagger has a %+d against %ss”, $integer, $string);

Dagger has a +10 against cats

Using padding and width specifiers (default padding specifier of a space)

$string = ‘cat’; // length, 3 characters
echo ‘<pre>’; // HTML Required to display the formating properly
echo sprintf(“3 spaces added: |%6s”, $string);
// Used padding of 6 characters, 6 – 3 = 3 spaces padded

Pad from line 3 spaces: |   cat

Using padding and width using a zero ( 0 ) for padding

$month = 12;
$day = 1;
$year = 1980;
echo sprintf (” Date: %02d/%02d/%04d.”, $month, $day, $year);
$year = 80;
echo sprintf (” Date: %02d/%02d/%04d.”, $month, $day, $year);

Date: 12/01/1980. Date: 12/01/0080.

Using padding and width using a custom character, the asterisk ( * )

$endofpassword = ‘word’;
$output = sprintf(“Your password: %’*8s”, $endofpassword);
echo $output;

Your password: ****word

Using padding, alignment (left), and width

$endofpassword = ‘word’;
$output = sprintf(“Your password: %’*-8s”, $endofpassword);
echo $output;

Your password: word****

Using the precision specifier

$scientific = 1.2e3;
echo sprintf(“Three decimal places: %.3e”, $scientific);

Three decimal places: 1.200e+3

$float = 1.2e3;
echo sprintf(“Two decimal places: %.2f”, $float);

Two decimal places: 1200.00

$string = ‘Hello World!’;
echo sprintf(“Cut-off after 4 characters: %.4s”, $string);

Cut-off after 4 characters: Hell

See Also:

printf() – prints a formatted string results rather than simply returning them
sscanf() – Parses a string through a formatted string, reverse of sprintf()

Language constructs vs functions in Control Structures

require(), require_once(), include(), include_once()

(pgs. 31-32)

Throughout the noted pages and scattered in a few other places, the above four are referred to as functions, when technically they are considered language constructs. While minor, it should still be clarified. All the functionality and examples are accurate, just some terminology clarifications.