Given the following code, what will be the value of $a?
$a = array('a', 'b');
array_push($a, array(1, 2));
You are creating an application that repeatedly connects to a database to retrieve order data for invoices. All data comes from the same database. In order to preserve resources, you have to ensure that only one database connection should be used at any time. The code also has to open as few new database connections as possible. Which design pattern should you use for this scenario?
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);
What is the output of the following script?
1
2 class a
3 {
4 public $val = 10;
5 }
6
7 function renderVal (a $a)
8 {
9 return $a->$val;
10 }
11
12 renderVal (new a);
13 ?>