PHP exam questions

The following questions are to help you identify where you need more work or for use as a fun quiz-show style game in a classroom.

The questions are divided into beginner, intermediate and advanced sections.

Beginner Edit

  1. Write the code that you can include in your file to finkkkkkkd out not only whether PHP is supported on your server, but also which version etc.
  2. When testing your PHP pages, identify two likely causes of seeing the actual PHP code in your web browser.
  3. You're writing a program and need to create a variable called 'count' and set it's initial value to zero. Write the (a) Javascript code that will create your variable, followed by the (b) PHP code that will create your variable.
  4. convert the following psuedo-code into PHP:
if the variable $firstname is currently empty, then do the following:
print out the text "You need to enter your firstname" as a paragraph with the class="errormsg"