3 Months Free Update
3 Months Free Update
3 Months Free Update
Which constant must be passed as the second argument to htmlentities() to convert single quotes (') to HTML entities?
What is the output of this code?
$world = 'world';
echo <<<'TEXT'
hello $world
TEXT;
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?
function increment ($val)
{
$_GET['m'] = (int) $_GET['m'] + 1;
}
$_GET['m'] = 1;
echo $_GET['m'];
What is the output of the following code?
function fibonacci (&$x1 = 0, &$x2 = 1)
{
$result = $x1 + $x2;
$x1 = $x2;
$x2 = $result;
return $result;
}
for ($i = 0; $i < 10; $i++) {
echo fibonacci() . ',';
}
Which interfaces could class C implement in order to allow each statement in the following code to work? (Choose 2)
$obj = new C();
foreach ($obj as $x => $y) {
echo $x, $y;
}
Your application uses PHP to accept and process file uploads. It fails to upload a file that is 5 MB in size, although upload_max_filesize is set to "10M". Which of the following configurations could be responsible for this outcome? (Choose 2)
Which of the following code snippets DO NOT write the exact content of the file "source.txt" to "target.txt"? (Choose 2)
What is the output of the following code?
$a = 'a'; $b = 'b';
echo isset($c) ? $a.$b.$c : ($c = 'c').'d';
Consider the following XML code:
Which of the following SimpleXML calls prints the name of the second book?
(Let $xml = simplexml_load_file("books.xml"); .) (Choose 2)
Consider the following code. Which keyword should be used in the line marked with "KEYWORD" instead of "self" to make this code work as intended?
abstract class Base {
protected function __construct() {
}
public static function create() {
return new self(); // KEYWORD
}
abstract function action();
}
class Item extends Base {
public function action() { echo __CLASS__; }
}
$item = Item::create();
$item->action(); // outputs "Item"
What function can reverse the order of values in an array so that keys are preserved?
Given the following code, how can we use both traits A and B in the same class? (select all that apply)
trait A {
public function hello() {
return "hello";
}
public function world() {
return "world";
}
}
trait B {
public function hello() {
return "Hello";
}
public function person($name) {
return ":$name";
}
}
What is the pattern modifier for handling UTF-8 encoded preg_* functionality?
What will the following code piece print?
echo strtr('Apples and bananas', 'ae', 'ea')
What is the method used to execute XPath queries in the SimpleXML extension?
Please provide the name of the super-global variable where all the information about cookies is available.
What is the output of the following code?
class Bar {
private $a = 'b';
public $c = 'd';
}
$x = (array) new Bar();
echo array_key_exists('a', $x) ? 'true' : 'false';
echo '-';
echo array_key_exists('c', $x) ? 'true' : 'false';
Your public web application needs to provide access to binary files for registered users only. How would you achieve this?
When a browser requests an image identified by an img tag, it never sends a Cookie header.
What is the output of the following code?
function increment ($val)
{
$val = $val + 1;
}
$val = 1;
increment ($val);
echo $val;
Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?