What is the output of the following script?
1
2 function fibonacci ($x1, $x2)
3 {
4 return $x1 + $x2;
5 }
6
7 $x1 = 0;
8 $x2 = 1;
9
10 for ($i = 0; $i < 10; $i++) {
11 echo fibonacci($x1, $x2) . ',';
12 }
13 ?>
Can a private static member be accessed from a public static method of the same class?
Is the following code piece E_STRICT compliant?
final class Testing {
private $test;
public function tester() {
return "Tested!";
}}
Which of the following are valid SoapClient calls? (Choose 2)
Which of the listed changes would you make to the following PHP 4 code in order to make it most compliant with PHP 5? (Choose 2)
class Car {
var $model;
function Car($model) {
$this->model = $model;
} function toString() {
return "I drive a $this->model.";
}}
$c = new Car('Dodge');
echo $c->toString();
?>
Which of the following statements about database connections are commonly true? (Choose 2)
Assuming UTF-8 encoding, what is the value of $count?
What is the output of the following code?
$a = 1;
++$a;
$a*=$a;
echo $a--;
You want to extract the pieces of a date string, which looks like this:
"2005-11-02". Which of the following pieces of code will properly assign $year,
$month and $day with their respective values?
What will the following code print?
echo addslashes('I am a small "HTML" string, which is
\'invalid\'.');
When checking whether two English words are pronounced alike, which function should be used for the best possible result?
Which DOMElement property provides a reference to the list of Element's children?
Which of the following parts must a XML document have in order to be well-formed?
What does the __FILE__ constant contain?
Which of the following statements is true?
You want to extract the pieces of a date string, which looks like this: "2005-11-02". Which of the following pieces of code will property assign $year, $month and $day with their respective values?
What function allows resizing of PHP's file write buffer?
Which of the following statements about PHP is true? (Choose 3)
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);
Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?
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 ?>
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?
What method can be used to find a tag with the name "foo" via the DOM extension?
Which PHP function sets a cookie whose value does not get URL encoded when sending it to the browser?
Given a JSON-encoded string, which code sample correctly indicates how to decode the string to native PHP values?
Which piece of code will return the ASCII value of a character?
Consider the following code. What can be said about the call to file_get_contents?
What is the function of backtick (`) characters in PHP?
Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?
What is "instanceof" an example of:
Which of the following XML declarations is NOT valid?
What is the output of the following code?
A/hen comparing prepared statements and regular, application-constructed SQL statements, which of the following is true?
The function mysqli_affected_rows() can be used to perform which of the following actions? (Choose 2)
Type hinting in PHP allows the identification of the following variable types: (Choose 2)
Which of the following function signatures is correct if you want to have classes automatically loaded?
What type of class definition can be used to define multiple inheritance?
Which of the following statements are correct? (Choose 2)