Check out Scrivo

Do you want to try out Scrivo? Then here's a demo for you that does not just get your feet wet but lets you plunge right in.

Contact us

For more information, please contact us. We're happy to help you out!

Next Oct 31 Previous

Happy Happy Joy Joy

Take this nonsense program:

<?php

    $fun = new Fun();
    $lol = 2 * $fun->happy() + 2 * fun->joy();

?>

When you discuss this program with a colleague you will refer to $fun as:

A: a class
B: an instance
C: an object
D: Yeah right, I'm off to see my favorite cartoon show.

Answer

In OO lingo the term class refers to a definition: the definition that you've put down in source code. When you create something with the keyword new using this definition (or class) then you create an instance of the class. So answer B might be correct.

However instances of classes are commonly referred to as objects so answer C is even better.

As for D: It depends whether you are already ZCE or not. In that case this is the correct answer and you can quit practising questions and watch Ren and Stimpy cartoons all day (like me).