Welcome to PHP This!

Welcome to the PHP This! blog!!  I’m Michelle, the author of PHP This! A Beginners Guide to Learning Object Oriented PHP (CLICK HERE to get a free copy of the book in PDF format)This blog, like the book, is a tool for developers who are new to object oriented PHP and its advanced features.

My intention for this blog is to create a platform for beginning and mid-level OO PHP developers to ask questions, learn and share what they have learned about PHP web development including using JQuery, CSS3, HTML4 & 5, AngularJS and other peripheral tools and techniques in conjunction with object oriented PHP.

There are no questions that are too trivial or simple to ask as this blog is intended to be a comfortable place for beginning to junior level PHP developers.  For visitors who are experienced PHP developers, we appreciate any wisdom you may be willing to share with those are newer to advanced PHP.

Everyone please be respectful to one another and I look forward to the new friends and colleagues I hope to meet here.



13 Responses to “Welcome to PHP This!”

  1. juliand says:

    Could someone please tell me where I can download the code examples for the book? The IP address given does not work.
    Thank you. (please email julian@mysteriousmovies.com)

  2. kadin says:

    Can someone help me understand this. [ //does class exist? controller. ] I search through all the php files and cannot find a class named controller. Thanks.

    //instantiate the requested controller as an object
    public function CreateController()
    //does the class exist?
    if (class_exists($this->controller))
    $parents = class_parents($this->controller);
    //does the class extend the controller class?
    if (in_array(“BaseController”,$parents))
    //does the class contain the requested method?
    if (method_exists($this->controller,$this->action))
    return new $this->controller($this->action,$this->urlvalues);
    return new Exception(“Bad Method: ” . $this->urlvalues);
    return new Exception(“Bad Controller: ” . $this->urlvalues);
    return new Exception(“Bad Controller: ” . $this->urlvalues);

  3. Kadin,

    There’s no class that is named “controller.” If you look in the Controller directory that came with the source code you’ll see 5 separate files named add, assign, edit, show and home. Each of those contains a class that is named the same as the file. Each of these classes extends the BaseController class which is in a file that is in the HelperClass directory.

    So for example, add.php has a class named Add that extends BaseController. This class named “Add” IS a controller. The same applies to the rest of those files in the controller directory.

    In the code snippet you posted above, that is the Loader class that takes the elements of the URL and determines what controller is being called and what is the action in the controller that is being called. On page 69 (PDF version) the MVC URL structure is shown as:

    Using the Add controller and the action Display that’s in the Add Class, this URL would be:


    and The Loader would know to call the Add controller and invoke the Display action.

  4. rlm2014 says:

    Bought this on amazon. Good read so far however the images of the code snippets are proving to be a bit of a nightmare in kindle. Especially PC. Would have liked to have the kindle edition open whilst trying out the code, however albeit you can enlarge text you cannot zoom in on the images/code and it’s just too small to easily read.

    I know you have made the source code available, but can I ask do you provide this book in any other formats?

    Many thanks.

  5. Michael Husen says:

    I am trying to learn MVC via your book PHP This! and I have downloaded the files for the restaurant menu system via the url in your book. But I run into this problem:

    When I call the application without parameters, the Interpretor defaults to the controller “show” and the action “index”, but the controller class (controllers/show.php) does not have a method called “index”. I get this output:

    Notice: Array to string conversion in /hsphere/local/home/mihus/husen.dk/mhsoft/restaurant/helperclasses/Interpretor.php on line 49 Fatal error: Call to undefined method Exception::ExecuteAction() in /hsphere/local/home/mihus/husen.dk/mhsoft/restaurant/index.php on line 33

    Am I doing something wrong?

    Kind regards
    Michael Husen

  6. arehman says:


    I’ve been following code examples in your book and at the end of chapter 7 when you view the application so far it issues following error:

    Fatal error: Call to a member function ExecuteAction() on a non-object in /var/www/html/index.php on line 26

    Looking at Interpreter.php file, there is no ExecuteAction funtion in there but BaseController.php file does. Can you help to clarify pease?


  7. The Interpreter class in the Interpreter.php file breaks down the URL into segments all separated by a forward slash, http://domain/controller/action/id

    Once it knows which controller to use, it calls that particular controller from the Controller folder and that controller class inherits the BaseController and all of it’s methods.

    So if the URL is http://localhost/show/Display then the “show” class will be called in the controllers/show.php file, which inherits the BaseClass, and the “Display” action will be executed.

  8. Hello Michelle Gosney,
    is there a way to contact you? I am considering to use your text in an university course on OO-PHP.
    many regards,
    Ronald van Dijk

Leave a Reply

You must be logged in to post a comment.