What purpose do namespaces fulfill?
What purpose do namespaces fulfill?
when would you use namespaces?
When would you use classes and when would you use namespaces?
Which of these elements can be encapsulated by namespaces and made accessible from the outside?
Which of these elements can be encapsulated by namespaces and made accessible from
the outside?
What would you do?
You’d like to use the class MyDBConnection that’s defined in the
MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace, but you want to
minimize *as much as possible* the length of the class name you have to type. What would
you do?
How should you track errors on your production website?
How should you track errors on your production website?
What would be the output of the following code?
What would be the output of the following code? namespace MyFramework\DB; class
MyClass { static function myName() { return __METHOD__; } } print MyClass::myName();
Which of the following methods are available to limit the amount of resources available to PHP through php.ini
Which of the following methods are available to limit the amount of resources available to
PHP through php.ini? (Choose 2)
what would the output look like?
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!”)
Which line of code can be used to replace the INSERT comment in order to output "hello"?
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 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); }; }