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(){

function etc...


Recommended Answers

All 3 Replies

Member Avatar for diafol

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.

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.