How can the id attribute of the 2nd baz element from the XML string below be retrieved from the SimpleXML object
found inside $xml?
What is the name of the method that can be used to provide read access to virtual properties in a class?
Given a php.ini setting of
default_charset = utf-8
what will the following code print in the browser?
header('Content-Type: text/html; charset=iso-8859-1');
echo '✂✔✝';
Consider the following table data and PHP code. What is a possible outcome?
Table data (table name "users" with primary key "id"):
id name email
------- ----------- -------------------
1 anna alpha@example.com
2 betty beta@example.org
3 clara gamma@example.net
5 sue sigma@example.info
PHP code (assume the PDO connection is correctly established):
$dsn = 'mysql:host=localhost;dbname=exam';
$user = 'username';
$pass = '********';
$pdo = new PDO($dsn, $user, $pass);
$cmd = "SELECT name, email FROM users LIMIT 1";
$stmt = $pdo->prepare($cmd);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_BOTH);
$row = $result[0];
Which of the following statements about anonymous functions in PHP are NOT true? (Choose 2)
Which sentence describes the following regular expression match?
preg_match('/^\d+(?:\.[0-9]+)?$/', $test);
What is the output of the following code?
function increment ($val)
{
$val = $val + 1;
}
$val = 1;
increment ($val);
echo $val;
Which of the following is used to find all PHP files under a certain directory?
Which line of code can be used to replace the INSERT comment in order to output "hello"?
class C {
public $ello = 'ello';
public $c;
public $m;
function __construct($y) {
$this->c = static function($f) {
// INSERT LINE OF CODE HERE
};
$this->m = function() {
return "h";
};
}
}
$x = new C("h");
$f = $x->c;
echo $f($x->m);
What is the return value of the following code?
strpos("me myself and I", "m", 2)
An HTML form contains this form element:
When this form is submitted, the following PHP code gets executed:
move_uploaded_file(
$_FILES['myFile']['tmp_name'],
'uploads/' . $_FILES['myFile']['name']
);
Which of the following actions must be taken before this code may go into production? (Choose 2)
What is the name of the function that allows you register a set of functions that implement user-defined session handling?
The following form is loaded in a browser and submitted, with the checkbox activated:
In the server-side PHP code to deal with the form data, what is the value of $_POST['accept'] ?
What is the output of the following code?
class Base {
protected static function whoami() {
echo "Base ";
}
public static function whoareyou() {
static::whoami();
}
}
class A extends Base {
public static function test() {
Base::whoareyou();
self::whoareyou();
parent::whoareyou();
What DOMElement method should be used to check for availability of a non-namespaced attribute?
In order to create an object storage where each object would be stored only once, you may use which of the following? (Choose 2)
What is the output of the following code?
$a = 3;
switch ($a) {
case 1: echo 'one'; break;
case 2: echo 'two'; break;
default: echo 'four'; break;
case 3: echo 'three'; break;
}
Type hinting in PHP allows the identification of the following variable types: (Choose 2)
Consider the following code. What can be said about the call to file_get_contents?
$getdata = "foo=bar";
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $getdata
)
);
$context = stream_context_create($opts);
$result = file_get_contents('http://example.com/submit.php', false, $context);
What is the output of this code?
$world = 'world';
echo <<<'TEXT'
hello $world
TEXT;
Consider the following two files. When you run test.php, what would the output look like?
test.php:
include "MyString.php";
print ",";
print strlen("Hello world!");
MyString.php:
namespace MyFramework\String;
function strlen($str)
{
return \strlen($str)*2; // return double the string length
}
print strlen("Hello world!")
In the following code, which line should be changed so it outputs the number 2:
class A {
protected $x = array(); /* A */
public function getX() { /* B */
return $this->x; /* C */
}
}
$a = new A(); /* D */
array_push($a->getX(), "one");
array_push($a->getX(), "two");
echo count($a->getX());
PHP and Zend Framework Certifications | 200-550 Questions Answers | 200-550 Test Prep | Zend Certified PHP Engineer Questions PDF | 200-550 Online Exam | 200-550 Practice Test | 200-550 PDF | 200-550 Test Questions | 200-550 Study Material | 200-550 Exam Preparation | 200-550 Valid Dumps | 200-550 Real Questions | PHP and Zend Framework Certifications 200-550 Exam Questions