PLAY READ BLOG

Assess your experience with PHP

I estimate it would take you 39 steps in 9 minutes to Assess your experience with PHP.
What symbol is used to define namespace hierarchy?
  • \
  • : :
  • =>
  • ->
  • /
When mixing PHP with HTML code, what's the shortcut for echoing out values?
  • <?= $value ?>
  • <?= echo $value ?>
  • <?php $value ?>
How would you call a static method called foo on a class called MyClass?
  • MyClass->foo()
  • MyClass=>foo()
  • MyClass:foo()
  • MyClass : : foo()
  • new MyClass : : foo()
If you want to make sure user uploaded files are inaccessible to other users, what should you do with the files once you receive them?
1. Move the file to a directory that isn't web accessible

2. Restrict file uploads to logged in users

3. Change the permissions of the file after upload

4. Rename the file once it has been uploaded
  • 1.
  • 2.
  • 3.
  • 4.
What is the name of PHP's primary debugger, which allows remote debugging?
  • XHProf
  • Xdebug
  • PHPDebug
  • KCacheGrind
  • Pdebug
Variable scope is important! Imagine you have a $name variable defined outside and inside of a function. How do the two equally-named variables work together?
1. The variable defined outside of the function overwrites the other one

2. The variable defined inside the function overwrites the other one

3. Both variables store two different, independent values
  • 1.
  • 2.
  • 3.
How do you modify an existing cookie?
1. You simply set it again (with setcookie())

2. You delete the old one (deletecookie()) and then set a new one (setcookie())

3. You change its value (with updatecookie())
  • 1.
  • 2.
  • 3.
Effective software development include various testing methodologies. One of which is unit testing. What does unit testing test?
1. A software unit at a module level

2. A software unit, like a class, method or function

3. A software unit at a class level

4. An external code library as a unit

5. A software package to ensure functional integration
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
Whilst exceptions shouldn't occur, they will do so from time to time. Which of the following exceptions can be prevented during development?
1. User-input related exceptions (e.g. invalid data passed)

2. Syntax-related exceptions (e.g. forgot closing parenthesis)

3. Server-related exceptions (e.g. resource doesn't respond)
  • 1.
  • 2.
  • 3.
💡FUN FACT 💡PHP: Hypertext Preprocessor (or simply PHP) is a general-purpose programming language originally designed for web development. It was originally created by Rasmus Lerdorf in 1994
session_start() starts a new session. What else does it do?
1. It will also start a new session for all users

2. It will also resume an existing one if possible

3. It will also clear any previous sessions
  • 1.
  • 2.
  • 3.
Most of the time, your PHP files get parsed when needed because of an incoming request. However, you can also call PHP files and code directly via command line. When would this be useful?
1. For daily cleanup scripts

2. For utility scripts (e.g. initialize a database)

3. For user authentication scripts (e.g. sign in)
  • 1.
  • 2.
  • 3.
What's the best way to ensure you are getting the type of file you expect?
  • Base64 encode the file
  • Check the mime type
  • Check the file extension
  • Check the file name
  • Check the file size
If we have a look at superglobals overall, which type of information do they generally hold?
1. Information about the incoming request and the response sent by your application

2. Information about the incoming request and the server (environment) the code is running on

3. Information about the server (environment) the code is running on and your code itself
  • 1.
  • 2.
  • 3.
PHP code may be mixed into an otherwise "normal" HTML page. How is the PHP parser going to handle non-PHP (e.g. HTML, CSS) code in the file?
1. It translates it into PHP

2. It ignores it

3. It splits the file into a PHP and non-PHP version
  • 1.
  • 2.
  • 3.
Which of the following is the magic method that gets called when you use the new keyword?
  • __get()
  • __new()
  • __construct()
  • __call()
  • __create()
Composer has many features and uses, but primarily it is used for what?
1. Implementing automated testing within your application

2. Bootstrapping your application with a set of predefined scripts

3. Autoloading your own code as well as third party code

4. Including third party code within your application

5. Automatic linting and code quality analysis
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
What is the only code construct allowed before a namespace declaration?
  • trait
  • declare
  • const
  • class
  • function
Namespaces are available for PHP applications. If an application uses namespaces, they must be declared...
1. At the beginning of the initial entry file, usually the index.php file.

2. At the beginning of the file after the start tag with the only exception being the declare() function.

3. When a class is defined in a separate file and loaded into the application.

4. Within a class after the class name definition and pertaining to the class scope.
  • 1.
  • 2.
  • 3.
  • 4.
Get Started   

Or consider 73 other intentions.