I've been using php for a while now but I have not got my head around OOP

Why bother using them? I've read thru a few tutorials on using classes and
the examples given are quite simple. This is probably the problem - I just
can't see the benefit of using this style of programming.

Here is what I'm getting  at.

------------USING A CLASS-----------------
class Table {

    var $rows;
    var $columns;

    function MakeTable() {

        draw a table with $this->columns as the number of columns
        and $this->rows as the number of rows


$mytable = new Table;
$mytable->rows = 5;
$mytable->columns = 10;

---------------USING A NORMAL FUNCTION-----

function MakeTable($rows,$columns) {

    make a table with $rows as the number of rows
    and $columns as the number of columns


$rows = 5;
$columns = 10;


Using a class doesn't appear to give me any benefits - in fact the code is

I know that you can spawn more instances of the same class which sounds
useful, however I can also run my function as many times as I like using
different variables.

What am I missing here?



PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to