Getting Started

So, what did I do to get started with PHP. Well, I began with a Windows 7 laptop, which is probably not where most people start! it is probably easier with Linux.

String Concatenation

There are two ways to concatenate strings, you can use the concatenation operator or a printf function. The following example shows how these work with both strings and mixing strings and integers:

$partone = 'Hello ';
$parttwo = 'World ';
$output = $partone . $parttwo
$output = sprintf('%s%s', $partone, $parttwo)
$numone = 42;
$output = $output . $numone // $output .= $numone
$output = sprintf('%s%d', $output, $numone)

The documentation for this can be found at PHP: String Operators - Manual and PHP: sprintf - Manual.