NYCPHP Meetup

NYPHP.org

[nycphp-talk] oo php

Michele Waldman mmwaldman at nyc.rr.com
Fri Jun 12 23:53:19 EDT 2009


No.  There was no confusion between procedural and OO.  I was calling a
procedural function from an OO function.  I was in a hurry to customize a
class with some queried data not from a database class, which I could have
been using, but from some old procedural code that I had written.  Everyone
is always in a hurry and want me to produce immediately.  Whether or not I
integrate a db class into the code or use procedural database code is not an
issue.

 

I thought I was missing something in doing that other than writing
procedural code in the OO.  I had a typo in my include.  I wasn't getting a
php error, though.  I was getting nothing, so I was running through the
possibilities of problems.  I wasn't quite sure what was going on.  It took
me a few minutes to find I typed $_SEVER[, not $_SERVER[.  I figured it out
right after I posted.  I typed require, too and also didn't get an error.
Usually, I get an include or require error.  That's why I was confused for a
second.

 

I've been planning on doing more OO code.  There really hasn't been much of
an opportunity, but I ran into some weird issues with a xajax class for more
than one object, so I thought for a NY minute that there was a weird issue,
but their wasn't.  I want to do more oo, but I don't really see the
advantage even though I know the argued advantages.  I think oo is just
hipper.  Now, Sir Francis Bacon's Four Idles would argue against this kind
of motivation, but that's my only real motivation.  Hipness.

 

My bad for posting.  Sorry.  I really don't need you guys for much anymore,
but sometimes I think if I run into a seeming problem I'll consult y'all.
In the past, y'all have been very helpful, but I'm maturing a little in my
development.  I'm really getting to be more independent.  Sorry, for the
silly posting.  I still sometimes want to post here, even though I don't'
need to much anymore.  For any silly, little issue, I think "I'll ask the
guys".  But, thanks for your consideration.  It is great that you guys are
here in case a person is in a real bind.

 

Michele

  _____  

From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of David Mintz
Sent: Friday, June 12, 2009 1:11 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] oo php

 

 

On Fri, Jun 12, 2009 at 1:08 PM, David Mintz <vtbludgeon at gmail.com> wrote:

 

On Fri, Jun 12, 2009 at 8:24 AM, Greg Rundlett (freephile)
<greg at freephile.com> wrote:

Assuming the class definition is in memory b/c the defining file is loaded
(require, include, auto-load),
you can call the method by either:
a) instantiating an object instance of the class and then calling the method
b) calling the method statically (having no object).
See the manual for an example:
http://us.php.net/manual/en/language.oop5.basic.php

 

It looks like Michele's original snippet had the method marked as private.
That means by definition that the method can only be called from within the
class itself -- $this->somePrivateMethod()


Sorry I spoke too soon. I see Michele was talking about invoking dbConnect()
from within the private method (duh). On a second look it seems there may be
some confusion between procedural vs OO. 


-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090612/a2ac30df/attachment.html>


More information about the talk mailing list