redarrow Posted September 5, 2009 Share Posted September 5, 2009 I am trying to learn OOP, and i have created this crap, i want to no what it all about cheers? <?php class Life_Story { function about_me($my_arms,$my_legs,$my_disabilty){ echo" The number of legs i got is\n$my_legs and the number of arms i got is\n$my_arms i also got a disabilty in my\n$my_disabilty"; } } $Life_Story = new Life_Story(); $Life_Story -> about_me($my_arms=2,$my_legs=2,$my_disabilty="eyes"); ?> i get what the oop is doing, but don't understand where to use this type off programming and how to, please help. <?php class Life_Story { function about_me($my_arms,$my_legs,$my_disabilty){ echo" The number of legs i got is\n$my_legs and the number of arms i got is\n$my_arms i also got a disabilty in my\n$my_disabilty"; } } $Life_Story = new Life_Story(); $Life_Story -> about_me($my_arms=2,$my_legs=2,$my_disabilty="eyes"); $Life_Story2 = new Life_Story(); $Life_Story2 -> about_me($my_arms=1,$my_legs=2,$my_disabilty="head"); ?> Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 5, 2009 Share Posted September 5, 2009 That is not OOP, sorry. Try to read the tutorials we have on the main site. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 5, 2009 Share Posted September 5, 2009 OOP is one of those things you learn more about by doing. I would suggest you have a read of some texts on OOP and design patterns to see where real world comes in to play. http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612 is apparently a ubiquitous text. I would also recommend http://www.amazon.com/PHP-Architects-Guide-Design-Patterns/dp/0973589825 - old book but I found it useful. As you progress you will find more resources and I'm sure others will contribute valuable resources if asked. Good luck with it fella - once you get into OOP you won't look back. Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 5, 2009 Author Share Posted September 5, 2009 i got a £200 oop course sitting here it totally crap, more wasted money. i want to learn oop for php because it the way forward i thort, owe well thanks for the book links ... Quote Link to comment Share on other sites More sharing options...
redarrow Posted September 5, 2009 Author Share Posted September 5, 2009 what the flow, to cheek a username to a var set username within a class from a form posted then cheers. example say i use this code, to see the oop form, and i want to match the set var name of username from the oop to match the name entred in a form how that done cheers. <?php if(isset($_POST['submit'])){ $username=$_POST['username']; if($username==Message_Users()->$username){ echo correct; exit; } } class Message_Users{ var $username="redarrow"; var $password="redarrow"; function form(){ echo"<form method='POST'> username <br /> <input type='text' name='username'> <br /> password <br /> <input type='password' name='password'> <br /><br /> <input type='submit' name='submit' value='SEND!'> </form>"; } } $Message_Users= new message_Users(); $Message_Users->form(); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.