PHP Online Test

TestDome skill assessments are used by more than 5,000 companies and 450,000 individual test takers.

Jobseekers: Get a Certificate

Take a Practice Test

Companies: Try First, Pay Later

Sign Up To Use This Test

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 Associative arrays 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 Inheritance 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
Greeter, Read First Line, Filter, Last Key, Word Count, Needle, Height, Shipping, Array Search, Read Write Execute, Segment, Numbers to Text, Array Sum, Category Tree, Chain Link, Chicken, Cookie, Crop Ratio, Date Transform, Hobbies, Log Parser, Paragraph, Products, Unique Numbers, Username, Vectors, View Count, Language Teacher
Skills
PHP Language Exceptions Arrays Strings Stream Arithmetic Recursion Pass by reference Associative arrays Linked list Interfaces OOP Session Bug fixing Integer division Regex Iteration Serialization XML JSON Sorting Algorithmic thinking Inheritance
Score Distribution
Loading...
Pricing For Premium Questions