Connecting Tech Pros Worldwide Help | Site Map

PHP and classes

  #1  
Old July 17th, 2005, 03:28 AM
Handover Phist
Guest
 
Posts: n/a
Specefically, how do they work? php.net describes them as a collection
of variables and functions working with these variables. So far I'm
doing this with collections of function and include''; statements. For
any given operation, a link will include a $_GET['thing'] variable. The
index then have:

if ((isset($_GET['thing'])) && ($_GET['thing'] == "linkname")) {
include 'useful_pile_of_functions.php';
}

This method seems to me to be somewhat like using includes as classes,
as the called file contains everything needed to support the users
desired function. How is using classes better than this method?

--
Could you tell us lazy, ignorant, impolite newbies where to find out
more about SYSOP, please?
-- A. Lucien Meyers
  #2  
Old July 17th, 2005, 03:28 AM
Shawn Wilson
Guest
 
Posts: n/a

re: PHP and classes


Handover Phist wrote:[color=blue]
>
> Specefically, how do they work? php.net describes them as a collection
> of variables and functions working with these variables. So far I'm
> doing this with collections of function and include''; statements. For
> any given operation, a link will include a $_GET['thing'] variable. The
> index then have:
>
> if ((isset($_GET['thing'])) && ($_GET['thing'] == "linkname")) {
> include 'useful_pile_of_functions.php';
> }
>
> This method seems to me to be somewhat like using includes as classes,
> as the called file contains everything needed to support the users
> desired function. How is using classes better than this method?[/color]

Every couple-few weeks someone asks this question. I suggest you search google
groups. You should find plenty of opinions there :o)

Regards,
Shawn
--
Shawn Wilson
shawn@glassgiant.com
http://www.glassgiant.com

I have a spam filter. Please include "PHP" in the
subject line to ensure I'll get your message.
  #3  
Old July 17th, 2005, 03:28 AM
Handover Phist
Guest
 
Posts: n/a

re: PHP and classes


Shawn Wilson blithely blithered[color=blue]
> Handover Phist wrote:[color=green]
>>
>> Specefically, how do they work? php.net describes them as a collection
>> of variables and functions working with these variables. So far I'm
>> doing this with collections of function and include''; statements. For
>> any given operation, a link will include a $_GET['thing'] variable. The
>> index then have:
>>
>> if ((isset($_GET['thing'])) && ($_GET['thing'] == "linkname")) {
>> include 'useful_pile_of_functions.php';
>> }
>>
>> This method seems to me to be somewhat like using includes as classes,
>> as the called file contains everything needed to support the users
>> desired function. How is using classes better than this method?[/color]
>
> Every couple-few weeks someone asks this question. I suggest you search google
> groups. You should find plenty of opinions there :o)
>
> Regards,
> Shawn[/color]

Thanks Shawn, I'll do that.

--
Yow! Maybe I should have asked for my Neutron Bomb in PAISLEY --
  #4  
Old July 17th, 2005, 03:29 AM
Dan Tripp
Guest
 
Posts: n/a

re: PHP and classes


Shawn Wilson wrote:

/snip
[color=blue]
> Every couple-few weeks someone asks this question. I suggest you search google
> groups. You should find plenty of opinions there :o)
>
> Regards,
> Shawn[/color]

Which kinda brings up a good point... where the heck is the FAQ for this
list?

I've googled it, and can't find one. If there isn't one, I'd be
interested in helping compile one. =)

At the top, I'd imagine it would say "The PHP manual is your friend." ;)

Regards,

- Dan
http://www.dantripp.com/
  #5  
Old July 17th, 2005, 03:35 AM
Shawn Wilson
Guest
 
Posts: n/a

re: PHP and classes


Dan Tripp wrote:[color=blue]
>
> Shawn Wilson wrote:
>
> /snip
>[color=green]
> > Every couple-few weeks someone asks this question. I suggest you search google
> > groups. You should find plenty of opinions there :o)
> >
> > Regards,
> > Shawn[/color]
>
> Which kinda brings up a good point... where the heck is the FAQ for this
> list?
>
> I've googled it, and can't find one. If there isn't one, I'd be
> interested in helping compile one. =)
>
> At the top, I'd imagine it would say "The PHP manual is your friend." ;)[/color]

I've googled too, with the same results. I'm not sure how those things get
started... But we could definitely use one.

Shawn
--
Shawn Wilson
shawn@glassgiant.com
http://www.glassgiant.com

I have a spam filter. Please include "PHP" in the
subject line to ensure I'll get your message.
  #6  
Old July 17th, 2005, 03:35 AM
Tim Van Wassenhove
Guest
 
Posts: n/a

re: PHP and classes


On 2004-01-19, Shawn Wilson <shawn@glassgiant.com> wrote:[color=blue]
> Dan Tripp wrote:[color=green]
>>
>> Shawn Wilson wrote:
>>
>> /snip
>>[color=darkred]
>> > Every couple-few weeks someone asks this question. I suggest you search google
>> > groups. You should find plenty of opinions there :o)
>> >
>> > Regards,
>> > Shawn[/color]
>>
>> Which kinda brings up a good point... where the heck is the FAQ for this
>> list?
>>
>> I've googled it, and can't find one. If there isn't one, I'd be
>> interested in helping compile one. =)
>>
>> At the top, I'd imagine it would say "The PHP manual is your friend." ;)[/color]
>
> I've googled too, with the same results. I'm not sure how those things get
> started... But we could definitely use one.[/color]

Most common things:

Why isn't my $var working? Because it is in $_REQUEST['var'] etc...
How to send e-mail with html in?
What's all that stuff about chmod?
Where can i find a win32 installer with apache+php+mysql?
Problems with slashes in win32
....


One question: As most of these people are to lazy to find these answers
via google groups, do you think that they will use the faq?

--
http://home.mysth.be/~timvw
  #7  
Old July 17th, 2005, 03:36 AM
Shawn Wilson
Guest
 
Posts: n/a

re: PHP and classes


Tim Van Wassenhove wrote:[color=blue]
>
> On 2004-01-19, Shawn Wilson <shawn@glassgiant.com> wrote:[color=green]
> > Dan Tripp wrote:[color=darkred]
> >>
> >> Shawn Wilson wrote:
> >>
> >> /snip
> >>
> >> > Every couple-few weeks someone asks this question. I suggest you search google
> >> > groups. You should find plenty of opinions there :o)
> >> >
> >>
> >> Which kinda brings up a good point... where the heck is the FAQ for this
> >> list?
> >>
> >> I've googled it, and can't find one. If there isn't one, I'd be
> >> interested in helping compile one. =)
> >>
> >> At the top, I'd imagine it would say "The PHP manual is your friend." ;)[/color]
> >
> > I've googled too, with the same results. I'm not sure how those things get
> > started... But we could definitely use one.[/color]
>
> Most common things:
>
> Why isn't my $var working? Because it is in $_REQUEST['var'] etc...
> How to send e-mail with html in?
> What's all that stuff about chmod?
> Where can i find a win32 installer with apache+php+mysql?
> Problems with slashes in win32
> ...
>
> One question: As most of these people are to lazy to find these answers
> via google groups, do you think that they will use the faq?[/color]

No. But every site that tries to teach it's readers about newsgroup etiquette
always says "lurk, then post" and "read the FAQ". If everyone obeyed those 2
rules, things would run a lot smoother. However, the nature of this particular
group precludes lurking in many cases (i.e. people first come here to solve a
pressing problem, like globals.) I am occasionally an idealist. If every group
took the time to make a FAQ, reading the FAQ would have a chance of becoming a
common thing to do. Also, a well-crafted FAQ could help those who do a quick
Google search before posting their problems.

Also:
RTFM.
Post small snippets of code.
Post error messages.
The best book for beginning PHP.
Check Google Groups.
The usual top/cross/multi-posting etiquette.

Regards,
Shawn
--
Shawn Wilson
shawn@glassgiant.com
http://www.glassgiant.com

I have a spam filter. Please include "PHP" in the
subject line to ensure I'll get your message.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
php classes within classes? thelobster@gmail.com answers 5 July 17th, 2005 11:28 AM
PHP Classes Logan K. answers 3 July 17th, 2005 11:06 AM
PHP Classes Jeremy Ross answers 4 July 17th, 2005 10:53 AM
Recommendations for PHP Form Validation Script Phil Powell answers 17 July 17th, 2005 02:14 AM
URGENT: variable scope in PHP classes Spidah answers 4 July 17th, 2005 12:39 AM