The PHP online test assesses candidates' knowledge of programming in PHP language and their ability to leverage commonly used built-in functions.

It's an ideal test for pre-employment screening. A good PHP developer needs to be able not only to solve problems using PHP as the programming language but also recognize when to take advantage of its rich set of built-in functions.

This test requires candidates to be able to solve coding problems in PHP and find and fix bugs in PHP programs.

Recommended Job Roles
PHP Developer
Web Developer
Sample Candidate Report

Sample Free Questions

File Owners

10min
  -  
Easy  
  -  
CODE

PHP Language Public

Implement a groupByOwners function that:

  • Accepts an associative array containing the file owner name for each file name.
  • Returns an associative array containing an array of file names for each owner name, in any order.

For example, for associative array ["Input.txt" => "Randy", "Code.py" => "Stan", "Output.txt" => "Randy"] the groupByOwners function should return ["Randy" => ["Input.txt", "Output.txt"], "Stan" => ["Code.py"]].

Merge Names

10min
  -  
Easy  
  -  
CODE

PHP Arrays Public

Implement the unique_names function. When passed two arrays of names, it will return an array containing the names that appear in either or both arrays. The returned array should have no duplicates.

For example, calling unique_names(['Ava', 'Emma', 'Olivia'], ['Olivia', 'Sophia', 'Emma']) should return ['Emma', 'Olivia', 'Ava', 'Sophia'] in any order.

User Input

15min
  -  
Easy  
  -  
CODE

PHP OOP Public

The user interface contains two types of user input controls: TextInput, which accepts all texts and NumericInput, which accepts only digits.

Implement the class TextInput that contains:

  • Public function add($text) - adds the given text to the current value.
  • Public function getValue() - returns the current value (string).

Implement the class NumericInput that:

  • Inherits from TextInput.
  • Overrides the add method so that each non-numeric text is ignored.

For example, the following code should output '10':

$input = new NumericInput();
$input->add('1');
$input->add('a');
$input->add('0');
echo $input->getValue();
Use Free Questions On a Trial Plan

Premium Questions

The premium question library contains our unique, hand-crafted questions. We offer a refund if you find any of them answered online.

Questions
Cookie, Chain Link, Crop Ratio, Hobbies, Category Tree, Programmer Teacher, Greeter, Read First Line, Chicken, Numbers to Text, Products, Array Sum, Filter, Paragraph, Last Key, Vectors, Word Count, Log Parser, Needle, Height, Username, View Count, Unique Numbers, Shipping, Array Search, Read Write Execute, Date Transform, Segment
Skills
PHP Language Data structures Bug fixing Arrays Iteration OOP Exceptions Strings Serialization Sorting Arithmetic Searching Stream Algorithmic thinking Recursion
Score Distribution
Loading...
Pricing For Premium Questions