You are creating an application that generates invoices in a variety of formats, including PDF, ODS and HTML. Each of these formats is represented as a PHP class in your application. While some of the operations can be performed on all of the different formats (such as saving and loading), other operations may be specific to one or two of the formats (such as setting as read only). Which design pattern should you use for this application?
How many elements does the $matches array contain after the following function call is performed?
preg_match('/^(\d{1,2}([a-z]+))(?:\s*)\S+ (?=200[0-9])/', '21st March
2006', $matches);
How many times will the function counter() be executed in the following code?
function counter($start, &$stop)
{
if ($stop > $start)
{
return;
} counter($start--, ++$stop);
}
$start = 5;
$stop = 2;
counter($start, $stop);
You have a variable $test that contains sub-strings divided by a dash ("-"). How can you put every sub-string into an array element easily?
One common security risk is exposing error messages directly in the browser. Which PHP configuration directive can be disabled to prevent this?
Which of the following data types is implicitly passed by reference in PHP 5 while it is passed by value in PHP 4?