Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-31-2009, 02:59 PM   #1
ro8in
Confirmed User
 
ro8in's Avatar
 
Industry Role:
Join Date: Sep 2006
Posts: 1,542
PHP programmers in here please!

if I had a class lets say

class myclass {
function myfunction() {

}
}

Why in the world would I do

$myclass = new myclass

and use the function as
$myclass->myfunction

while I can forget all that and just do

myclass::myfunction()


what can be a possible reason not to use the double colon way??

i can't think of any...
__________________
------
Offcourse its a dude posting here. Probably a fut ugly one too. Fuck still people falling for this 100 year old trick
ro8in is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-31-2009, 03:06 PM   #2
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
the point of classes isn't so you can put functions inside of them...

the point is that you create objects, which have certain properties, and you make them do stuff by calling certain methods...
__________________
Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-31-2009, 03:15 PM   #3
ro8in
Confirmed User
 
ro8in's Avatar
 
Industry Role:
Join Date: Sep 2006
Posts: 1,542
thanks for your reply

I get it now

using :: is just static

while the other way I could do

$myclass1 = new myclass("yourname")
$myclass2 = new myclass("myname")

then $myclass1 and $myclass2 would refer to the same class but have different properties..

intresting stuff....

but why php can only extend one class?
__________________
------
Offcourse its a dude posting here. Probably a fut ugly one too. Fuck still people falling for this 100 year old trick

Last edited by ro8in; 10-31-2009 at 03:17 PM..
ro8in is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-31-2009, 04:16 PM   #4
redwhiteandblue
Bollocks
 
redwhiteandblue's Avatar
 
Industry Role:
Join Date: Jun 2007
Location: Bollocks
Posts: 2,793
Quote:
Originally Posted by ro8in View Post
intresting stuff....

but why php can only extend one class?
PHP doesn't support multiple inheritance if that's what you mean. But you can derive a class from another class that is derived from another class and so on.
redwhiteandblue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.