Which of the following code snippets DO NOT write the exact content of the file "source.txt" to "target.txt"? (Choose 2)
A. file_put_contents("target.txt", fopen("source.txt", "r"));
B. file_put_contents("target.txt", readfile("source.txt"));
C. file_put_contents("target.txt", join(file("source.txt"), "\n"));
D. file_put_contents("target.txt", file_get_contents("source.txt"));
E. $handle = fopen("target.txt", "w+"); fwrite($handle, file_get_contents("source.txt")); fclose($handle);
Given the following DateTime objects, what can you use to compare the two dates and indicate that
$date2 is the later of the two dates?
$date1 = new DateTime('2014-02-03');
$date2 = new DateTime('2014-03-02');
A. $date2 > $date1
B. $date2 < $date1
C. $date1->diff($date2) < 0
D. $date1->diff($date2) > 0
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);
A. A GET request will be performed on http://example.com/submit.php
B. A POST request will be performed on http://example.com/submit.php
C. An error will be displayed
What is the output of the following code?
class A {
public $a = 1;
public function __construct($a) { $this->a = $a; }
public function mul() {
return function($x) {
return $this->a*$x;
};
}
}
$a = new A(2);
$a->mul = function($x) {
return $x*$x;
};
$m = $a->mul();
echo $m(3);
A. 9
B. 6
C. 0
D. 3
Which of the following functions are used to escape data within the context of HTML? (Choose 2)
A. htmlentities()
B. addslashes()
C. stripslashes()
D. strip_tags()
E. htmlspecialchars()
When a browser requests an image identified by an img tag, it never sends a Cookie header.
A. TRUE
B. FALSE
Which of the following can be registered as entry points with a SoapServer instance (choose 2):
A. A single function
B. A single method from a class
C. All methods from a class
D. All classes defined in a script
Which sentence describes the following regular expression match? preg_match('/^\d+(?:\.[0-9]+)?$/', $test);
A. It matches float numbers with thousand seperators.
B. It matches float numbers without thousand seperators.
C. It matches binary integer numbers.
D. It matches any string.
E. It does not match anything
Given the default PHP configuration, how can all of the parameters provided via GET be accessed in a form of a string?
A. $_GET['ALL']
B. $_SERVER['QUERY']
C. $_SERVER['QUERY_STRING']
D. $_ENV['QUERY']
E. $QUERY_STRING
Which PHP function sets a cookie whose value does not get URL encoded when sending it to the
browser?