Object Oriented Programming with PHP?

This is a discussion on "Object Oriented Programming with PHP?" within the PHP Forum section. This forum, and the thread "Object Oriented Programming with PHP? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Jan 18th, 2008, 22:30
JustinStudios's Avatar
Reputable Member
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Object Oriented Programming with PHP?

I am being trained to write Java. It's wonderful! Now however, I am seeing this "Object Oriented PHP" and want to know, is it just like Java? I know the code is PHP, but do you just call an "Object" by using an include and let it run its course? If so, I am going to start doing this because it just makes more since than copying and pasting files from my library over and over again.

Anyone do OOP PHP? If so I'd love to hear tips and or comments!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Jan 18th, 2008, 22:37
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Object Oriented Programming with PHP?

Not really like JAVA.
Less strict and yet restrictive.
You can' inherit multiple classes.
here is some pseudo code:
PHP: Select all

//php 4
class myclass {
//properties 
var $str "string";

//construct
function myclass() {
$this->helloworld();
}

//methods
function helloworld() {
echo 
"hello world";
}
}
$obj = new myclass(); //prints hello world
$obj->helloworld(); //same again 
Anything else you need to know?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Jan 18th, 2008, 22:46
JustinStudios's Avatar
Reputable Member
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Object Oriented Programming with PHP?

AHHHHHHHHHHHHHHHHHHHHHHHH! That is so fricken cool! I am so going to go learn how to do this!

couple of quick questions though:
1) Where do you store your classes? Can you make a file that has these that you can just import into any page that needs to access them?

2) Do you know where some "Good" resources for this are? Because google shows many resources but finding a good one is rough.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Jan 18th, 2008, 22:49
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Object Oriented Programming with PHP?

1. Depends on whether you are using PHP4 or PHP5.
If the former (and hopefully), then you can use the awesome fantastic magic function __autoload();
This function will automatically load the class if you haven't included it.
Google __autoload for more info.

2. I have a book but I did know of some good sites, I'll let you know soon.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Jan 19th, 2008, 03:12
JustinStudios's Avatar
Reputable Member
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Object Oriented Programming with PHP?

Sweet! Thanks.. I posted this when you were online because I noticed you mention something about OOP PHP a while back in a post.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Jan 19th, 2008, 12:35
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Object Oriented Programming with PHP?

Yeah I love OO PHP!
Luke's OO PHP article should help.
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Jan 19th, 2008, 18:30
JustinStudios's Avatar
Reputable Member
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Object Oriented Programming with PHP?

Nice article. Wow, one found in the webforumz newsletter even.. maybe I should read that thing! haha, thanks again!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Jan 20th, 2008, 00:57
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Object Oriented Programming with PHP?

You may like this thread also http://www.webforumz.com/php-forum/6...ses-in-php.htm
And the newsletter is awesome!
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Jan 20th, 2008, 01:38
JustinStudios's Avatar
Reputable Member
Join Date: Mar 2007
Location: USA
Posts: 404
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Object Oriented Programming with PHP?

I started off on the Newsletter team working on a CMS for it, but business picked up that month and I just ran out of time. I believe you were my replacement :P.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Jan 20th, 2008, 11:25
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: Object Oriented Programming with PHP?

Quote:
Originally Posted by JustinStudios View Post
I started off on the Newsletter team working on a CMS for it, but business picked up that month and I just ran out of time. I believe you were my replacement :P.
Yeah, so far I've managed to create half of 3 CMSs. This one we're working on now should work though
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursive programming in php masha PHP Forum 4 Oct 1st, 2007 12:37
programming-designs.com programming-designs Free Web Site Critique 5 Aug 27th, 2006 19:31
ASP/SQL programming help squashed_Frog Classic ASP 3 May 15th, 2006 03:49
Dynamic Database oriented menu arora.a ASP.NET Forum 3 Feb 27th, 2006 13:16


All times are GMT. The time now is 20:33.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved