What is the outcome?
Consider the following table data and PHP code. What is the outcome? Table data (table name "users" with primary key "id"): PHP code (assume the PDO connection is correctly established): $dsn = 'mysql:host=localhost;dbname=exam'; $user= 'username'; $pass='********'; $pdo = new PD0($dsn, $user, $pass); try { $cmd = "INSERT INTO users (id,...
Transactions should be used to: (Choose 2)
Transactions should be used to: (Choose 2)A . Prevent errors in case of a power outage or a failure in the SQL connectionB . Ensure that the data is properly formattedC . Ensure that either all statements are performed properly, or that none of them are.D . Recover from user...
What is the output of the following code?
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 . 9B...
What is the output of the following code?
What is the output of the following code? function ratio ($xl = 10, $x2) { } if (isset ($x2)) { return $x2 / $xl; echo ratio (0);A . 0B . An integer overflow errorC . A warning, because $xl is not setD . A warning, because $x2 is not setE...
What will the $array array contain at the end of this script?
What will the $array array contain at the end of this script? function modifyArray (&$array) { for each ($array as &$value) { $value= $value+ 1; $value= $value+ 2; $array= array (1, 2, 3); modifyArray($array);A . 2, 3, 4B . 2, 3, 6C . 4, 5, 6D . 1, 2, 3View...
What is the difference between the spaceship operator(<=>) and the strcmp() function?
What is the difference between the spaceship operator(<=>) and the strcmp() function?A . There is no difference in functionalityB . strcmp() returns a Boolean value, the spaceship operator a numberC . strcmp() does a case-intensive comparison, the spaceship operator does notD . The spaceship operator returns -1, 0 or 1;...
Which of the following statements is true?
Consider 3 PHP files that are called asynchronously via XmlHttpRequest: Which of the following statements is true? (Choose two.)A . The total execution time for all 3 requests will be the maximum of the longest sleep() callB . The requests may be processed out of orderC . The requests are...
When a class is defined as final it:
When a class is defined as final it:A . Can no longer be extended by other classes.B . Means methods in the class are not over-loadable.C . Cannot be defined as such, final is only applicable to object methods.D . Cannot be instantiated.View AnswerAnswer: A
How should class MyObject be defined for the following code to work properly? Assume $array is an
How should class MyObject be defined for the following code to work properly? Assume $array is an array and MyObject is a user-defined class. $obj = new MyObject(); array_walk($array, $obj);A . MyObject should extend class ClosureB . MyObject should implement interface CallableC . MyObject should implement method _callD . MyObject...
What is the output of the following code?
What is the output of the following code? function z($x) { return function ($y) use ($x) { return str_repeat($y, $x); }; $a== z(2); $b = z(3); echo $a(3) . $b(2);A . 22333B . 33222C . 33322D . 222333View AnswerAnswer: B