Jump to content

PHP classes


Recommended Posts

A few pages outlining defining classes in PHP. I've noticed there isn't anything about classes on w3s tutorials and other websites has got crappy tutorials. All I want is know is what syntax I need to use for a specific thing. But I know that a lot of people who do not know about classes might find this helpful in learning OOP and classes.

Link to post
Share on other sites
Why not just go to the source:http://www.php.net/manual/en/language.oop5.phpThat's what professionals do when they need to know this:
I did end up going to php.net but my main point is for new programmers. php.net is REALLY over whelming when you first start PHP I know I found it. A nice w3 example would be pretty helpful for newbies.
Link to post
Share on other sites
I did end up going to php.net but my main point is for new programmers. php.net is REALLY over whelming when you first start PHP I know I found it. A nice w3 example would be pretty helpful for newbies.
A newbie doesn't really need to know anything about classes to begin with. Understanding variables, conditions, loops, functions and superglobals is a requirement before one needs to know about classes.
Link to post
Share on other sites
A newbie doesn't really need to know anything about classes to begin with. Understanding variables, conditions, loops, functions and superglobals is a requirement before one needs to know about classes.
He's got you on that one, ApocalypeX. :)
Link to post
Share on other sites

A newbie does not need to know about creating classes. But often newbies are handed a class (or just find one in the net) for mailing or some other task, and they should have a basic sense about what's going on before they can use it correctly and wisely.(I really don't know what the school says or dousn't say about OOP in PHP. I don't see much on the main PHP page, but I could be missing something. I lose my glasses at least once a day, for instance.

Link to post
Share on other sites
A newbie doesn't really need to know anything about classes to begin with. Understanding variables, conditions, loops, functions and superglobals is a requirement before one needs to know about classes.
http://w3schools.com/js/js_objects.asp Javascript does. A similar page for PHP wouldn't hurt. Edited by ApocalypeX
Link to post
Share on other sites
A newbie does not need to know about creating classes. But often newbies are handed a class (or just find one in the net) for mailing or some other task, and they should have a basic sense about what's going on before they can use it correctly and wisely.(I really don't know what the school says or dousn't say about OOP in PHP. I don't see much on the main PHP page, but I could be missing something. I lose my glasses at least once a day, for instance.
Agree on that, but how do you explain class usage without explaining class creation in parallel? In PHP sence, I guess you could use the resource association (as we've done at least once in the forums), but that can be mistifying unless you bring in the big guns (see last posts in the linked topic).
Link to post
Share on other sites

It's necessary to understand objects in Javascript because literally everything in Javascript is an object. If you don't understand that you're not going to be very successful with Javascript. With PHP that's not necessarily the case, you may not be able to use certain object-oriented extensions, but not knowing about objects in PHP doesn't mean you can't still do a lot. I don't know whether they should or shouldn't have a tutorial about that, but just look at the manual, look at how much information there is. It sounds like you want that information compressed down into something that's easy to digest, but that means they have to take information out. There's a lot there you need to know about classes if you're going to use them, at least start with the intro and basics chapters. Also make sure to read the comments on the bottom of the pages. Pretty much every page has plenty of examples in the description and comments.

Link to post
Share on other sites
It's necessary to understand objects in Javascript because literally everything in Javascript is an object. If you don't understand that you're not going to be very successful with Javascript. With PHP that's not necessarily the case, you may not be able to use certain object-oriented extensions, but not knowing about objects in PHP doesn't mean you can't still do a lot. I don't know whether they should or shouldn't have a tutorial about that, but just look at the manual, look at how much information there is. It sounds like you want that information compressed down into something that's easy to digest, but that means they have to take information out. There's a lot there you need to know about classes if you're going to use them, at least start with the intro and basics chapters. Also make sure to read the comments on the bottom of the pages. Pretty much every page has plenty of examples in the description and comments.
I don't know maybe its just my beliefs of OOP being a good thing to learn in any language that supports it. Even though not always used by beginners shouldn't they be encouraged to improve their techniques? Of course there are times when procedural is more practical but a lot of times objects are better to use. Giving a little example of classes and then providing a link to php.net(or other places for more details) as a nudge towards them improving their techniques. Javascript & ASP.NET learners are lucky because objects are part of their core :)
Link to post
Share on other sites
I don't know maybe its just my beliefs of OOP being a good thing to learn in any language that supports it. Even though not always used by beginners shouldn't they be encouraged to improve their techniques?
Of course, that's what the manual is for. Don't expect to learn everything you need from a series of short online tutorials. They don't contain nearly close to everything you may need. Get yourself a couple books, read the manuals, etc. You need to seek information out, don't expect people to hand it to you. Take some responsibility to learn what you need to know. The information is out there if you want to find it.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...