Object Oriented PHP for Beginners

php_elephant
I think the Idea with this elephant logo is that you’ll associate PHP with smiley “cartoony” things and approach it with optimism. While I’m certain you can learn PHP, I’m not so fond of such attempts to obfuscate the fact that PHP is a language that will require some dedication to get your head around. Or maybe they just like elephants?

Here’s an excellent tutorial that introduces the concept of Object Oriented Programming (OOP) in PHP. It is written lucidly but may be a little confusing if you don’t already have some basic familiarity with the PHP language.

Here’s another tutorial if you find that one a bit much.

<?php
 
class MyClass
{
  public $prop1 = "I'm a class property!";
}
 
$obj = new MyClass;
 
echo $obj->prop1; // Output the property
 
?>
Setting and Outputting a Class Property