 |
|
 |
|
Next: Open word file using php in linux server
|
| Author |
Message |
External

Since: Jul 31, 2008 Posts: 4
|
(Msg. 1) Posted: Thu Jul 31, 2008 8:58 am
Post subject: Symbols used in classes. Archived from groups: comp>lang>php (more info?)
|
|
|
Hi all.,
Probably an old quesion, but im pretty new to php, and have not had
great success in searching.
Ive looking over some code which contains the following terms
$this
->
::
And have not clue as to what they mean. I have been looking at the php
documentation for classes and they appear there, but they are not well
explained. Can someone point me a good resource for explaining these,
or post me some explaination.s
Many thanks. >> Stay informed about: Symbols used in classes. |
|
| Back to top |
|
 |  |
External

Since: Jan 12, 2008 Posts: 17
|
(Msg. 2) Posted: Thu Jul 31, 2008 7:09 pm
Post subject: Re: Symbols used in classes. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Mar 01, 2006 Posts: 315
|
(Msg. 3) Posted: Thu Jul 31, 2008 7:20 pm
Post subject: Re: Symbols used in classes. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
..oO(Gerry)
>Probably an old quesion, but im pretty new to php, and have not had
>great success in searching.
>
>Ive looking over some code which contains the following terms
>
>$this
Refers to the current object, which invoked the method you're in.
>->
Used to access non-static members (methods and properties) of an object,
e.g.
$foo = new TFoo();
$foo->somePublicMethod();
(Inside the method somePublicMethod() $this would refer to $foo as the
object that called the method.)
>::
Scope resolution operator, used mainly to access static members of a
class, e.g.
TBar::someClassMethod();
print TBar::SOME_CLASS_CONSTANT;
Micha >> Stay informed about: Symbols used in classes. |
|
| Back to top |
|
 |  |
External

Since: Jul 31, 2008 Posts: 4
|
(Msg. 4) Posted: Fri Aug 01, 2008 6:50 am
Post subject: Re: Symbols used in classes. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Jul 31, 6:20 pm, Michael Fesser wrote:
> .oO(Gerry)
>
> >Probably an old quesion, but im pretty new to php, and have not had
> >great success in searching.
>
> >Ive looking over some code which contains the following terms
>
> >$this
>
> Refers to the current object, which invoked the method you're in.
>
> >->
>
> Used to access non-static members (methods and properties) of an object,
> e.g.
>
> $foo = new TFoo();
> $foo->somePublicMethod();
>
> (Inside the method somePublicMethod() $this would refer to $foo as the
> object that called the method.)
>
> >::
>
> Scope resolution operator, used mainly to access static members of a
> class, e.g.
>
> TBar::someClassMethod();
> print TBar::SOME_CLASS_CONSTANT;
>
> Micha
Many thanks Micha, Great answer, so when in instantiate te class, i
have a choice of either the name eg $foo, or $this, while in scope.
Just one more question then. What's the diference between a 'static'
and a non static member of the class object.
Cheers. >> Stay informed about: Symbols used in classes. |
|
| Back to top |
|
 |  |
External

Since: Jul 31, 2008 Posts: 4
|
(Msg. 5) Posted: Fri Aug 01, 2008 7:04 am
Post subject: Re: Symbols used in classes. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
|
| Back to top |
|
 |  |
External

Since: Mar 01, 2006 Posts: 315
|
(Msg. 6) Posted: Sat Aug 02, 2008 11:42 pm
Post subject: Re: Symbols used in classes. [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
..oO(Gerry)
>Just one more question then. What's the diference between a 'static'
>and a non static member of the class object.
For non-static members you always have to create an instance of a class
first, while static members can be called without that. If this doesn't
make much sense to you yet, check out the OOP section in the manual,
there are some examples.
Other examples for using static methods are the design patterns called
"singleton" and "factory". There you don't create the object with the
new operator, but call a static class method instead in order to get the
requested object.
Micha >> Stay informed about: Symbols used in classes. |
|
| Back to top |
|
 |  |
| Related Topics: | Can someone wxplain classes to me please - the why not wha.. - I understand what a class is but am confused as to why so many people are using them for what appear to be very simple PHP applications. I guess I dont know enough about how they are useful. for example I've just seen a "who is" application ...
Best way of calling multiple classes? - I'm designing a small framework with a lot of classes (1 file per class) and want to know the best method of calling each class? Obviously I could I call each file that is used but that could be 10 or more include statements. I am wonering if there is...
Plugin system: Automatically instantiate included classes? - Hi there, I am planning to implement a plugin system, based on the observer pattern in some way, but now I am stuck with the instantiation of the plugins. I want the plugins to have their own class, abstracted from the class Plugin. So far its nothing....
json and special chars - Hi! In my DB table I've chars like òèìù but when I generate json file I show \u00e0\u00f2\u00e8\u00ec\u00f9 is it right this change in my char? Thanks
Bootstrap for php developers - Hi ... I just started a project to make prototyping super quick. The idea is to create the navigation panels without writing any html from arrays. It also makes loading the boot strap easy with all the javascript plugins, so you can start developing a ph... |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|