0

Hello,

Am not new to PHP but new to OOP, I have watched lot of tutorials for oop and as I saw, class is almost a new language!!
To be a pro programmer, I should learn existing class attributes or I should create my own??

example of default class attribute:
$dbh = new PDO("mysql:host=localhost;dbname=test","root","");
$sth = $dbh -> query("select * from page");
$result = $sth -> fetch();

example of my own classic class:
class db{
function connect(){
mysql_pconnect('localhost','root','');
}

function etc...

}

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by cmps
1

I just started in the scary world of OOP myself. I would imagine that a programmer, is exactly that, somebody who programmes. Any idiot can be a script bunny, using other people's scripts. However, if a class exists, works and suits your needs, why reinvent the wheel? Tweak it. My 2p.

1

It is good to use existing class attributes to help you learn but only if you take the time to understand them and what they are doing so that in future you can create your own.

0

mm yeah i am actually finding some problem understanding, I think because of the course narrator, He's not a good teacher!!
Anw I will try to create my own class =) Thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.