HSHimanshu Sharma
Courses

PHP certificate: how the final exam and certificate work

Advertisement

The free PHP course ends with a final exam and a certificate that carries your name and can be checked by anyone with the link. This post explains the rules, the topics where the exam is most demanding, and how to prepare. It is the PHP companion to the posts on the HTML, CSS and MySQL certificates.

What you need first

  1. A free account.
  2. All 54 lessons ticked as complete: ten sections from "What PHP is and how it works" to the guestbook project. The exam stays locked until then, and the page shows your count.
  3. A pass in the exam.

If you want an overview of the course, read Learn PHP for free: a 54-lesson course.

The exam rules

Rule Value
Questions 15 multiple-choice questions
Question bank 40 questions; each attempt draws 15 at random
Time 30 minutes; the timer keeps running if you leave the page
Pass mark 70%, which is at least 11 correct
Attempts 3 in any rolling 24 hours

Many questions show a short piece of code and ask what it prints or why it fails. Part of the bank was checked by running the code in real PHP, so the intended answer is what PHP really does, not what a person would guess. That makes the exam fair but unforgiving of vague memory: you need to know the behaviour.

Topics that decide results

PHP has a few areas where its behaviour is surprising, and a good exam asks about them. Know these well.

Type juggling and comparison. "5" == 5 is true, "5" === 5 is false. In PHP 8, 0 == "abc" is false (earlier versions said true). Know what == converts and why === is safer. Know which values are falsy: 0, 0.0, "", "0", [], null, false.

Strings. Single quotes do not interpolate variables, double quotes do. echo 'Hi $name' prints Hi $name. Know strlen versus mb_strlen for multibyte text, and why byte functions can cut a character in half.

Arrays. The difference between indexed and associative arrays, what array_merge and the + operator do to duplicate keys, how sorting functions differ (sort, asort, ksort, usort) and what array_map, array_filter and array_reduce return. Remember that array_filter keeps the original keys.

Functions. Default and named arguments, typed parameters and return types, strict_types, passing by value versus by reference, closures and what use captures, arrow functions and automatic capture by value, and static variables inside functions.

Control flow. switch uses loose comparison, while match uses strict comparison and throws if nothing matches. The null-coalescing operator ?? versus the ternary ?:.

Forms and the web. $_GET versus $_POST, why you must validate on the server, how sessions and cookies differ, what session_start() must come before, and why you cannot send headers after output has started.

Files and errors. Modes of fopen, reading a whole file versus line by line, json_encode and json_decode (and associative arrays), exceptions with try, catch, finally and what happens to an uncaught exception.

Object-oriented PHP. Visibility (public, protected, private), constructors and promoted properties, readonly, inheritance and parent::, abstract classes versus interfaces, traits, static members and self versus static, enums, and namespaces with autoloading.

Databases and security. PDO with prepared statements and why they stop SQL injection, password_hash and password_verify (never md5), escaping output with htmlspecialchars against XSS, and CSRF tokens.

A revision plan

Allow a week for revision, after you finish the lessons.

  • Day 1: the basics. Run each example from the "Data types", "Strings" and "Comparisons" lessons and predict the output first.
  • Day 2: control flow and functions. Write your own match and closure examples.
  • Day 3: arrays. Use each sorting function on the same array and compare the results.
  • Day 4: forms, sessions and cookies. Rebuild a small form that validates and escapes.
  • Day 5: object-oriented PHP. Write one class with an interface, a trait and an enum.
  • Day 6: PDO and security. Write a prepared insert and a password check.
  • Day 7: retake the lesson quizzes and try the guestbook again from scratch.

Predicting output before running code is the best exam training there is. Write your guess on paper, then run it. Each wrong guess teaches a rule you will remember.

After you pass

The certificate appears on your dashboard. It shows your name, "PHP", your score, the date and an ID that starts MH-PHP-. Its public page, /learn/certificate/?id=<ID>, lets anyone confirm it, and the page also has a form to check an ID typed by hand. You can print or save it as a PDF, copy its link, or add it to LinkedIn (see How to add your certificate to LinkedIn and your CV).

Be clear about what it is. It records that you completed this course and passed its exam. It is not an accredited qualification. For PHP in particular, employers and clients will want to see code, so put a link to a small project (the guestbook, a contact form, a mini admin page) beside the certificate. A project hosted online, with its code on a public repository, says more than any certificate.

If you do not pass, look at the topics of the questions you missed, return to the matching lessons, run the examples and try again. Three attempts are available in each 24 hours; use the time between them to learn.

Where to go next

Quick answers

How many lessons do I need to finish? All 54.

How many exam questions are there? 15 per attempt, drawn from 40.

What is the pass mark? 70%, which is 11 correct.

Does the exam ask about PHP 8 features? Yes: the course teaches current PHP, including match, enums and typed properties.

Is the certificate free? Yes.

Advertisement