Page 1 of 2
what is the meaning of :: in php?
Posted: Sat Jul 16, 2011 5:36 am
by ashiland
please explain the codes bellow :
Plugins::init() ;
Rewrite::newInstance()->init();
Session::newInstance()->session_start() ;
many thanks in advance!
Re: what is the meaning of :: in php?
Posted: Sat Jul 16, 2011 7:10 am
by social_experiment
It the scope resolution operator.
FriendsofEd PHP Object orientated solutions wrote:
It gives access to overridden properties or methods of a parent class.
It is used to call the static methods and properties of a class.
It gives access to class constants .
Code: Select all
<?php
// calls method init in class Plugins
Plugins::init() ;
?>
Not too sure about the last two

Re: what is the meaning of :: in php?
Posted: Sat Jul 16, 2011 8:47 am
by ashiland
thanks indeed for your great help!
I didn't even know how it was called otherwise I would have searched for it.
Thanks again.
Re: what is the meaning of :: in php?
Posted: Sat Jul 16, 2011 8:58 am
by AbraCadaver
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.
The first example is calling the method init() of the Plugins class. In the next two the newInstance() method of the class is being called and this method is returning a new object instance of the class and then the init() and session_start() methods are being called on the new object that was returned using ->.
Re: what is the meaning of :: in php?
Posted: Sat Jul 16, 2011 1:09 pm
by ashiland
Thank you all guys! didn't how helpful could be the forums... getting to know all the nice people around trying to help.
Accurate answer ! many thanks.
Re: what is the meaning of :: in php?
Posted: Mon Aug 15, 2011 12:46 pm
by ashiland
does anyone know any good source to study classes?
Re: what is the meaning of :: in php?
Posted: Mon Aug 15, 2011 1:45 pm
by social_experiment
The manual, and a pdf i've read explains classes, how to use them and how to create them pretty well : Friends of Ed, Object Orientated Solutions by David Powers.
Re: what is the meaning of :: in php?
Posted: Mon Aug 15, 2011 10:26 pm
by ashiland
Is it for free?
Re: what is the meaning of :: in php?
Posted: Tue Aug 16, 2011 12:26 am
by ashiland
Hurry up please, I'm desperate to learn the classes.
I just need something simple with a lot of examples
Re: what is the meaning of :: in php?
Posted: Tue Aug 16, 2011 4:30 am
by social_experiment
ashiland wrote:I just need something simple with a lot of examples
The php manual contains 'simple' examples which you can use as reference when you create classes. Browse the forum aswell, there are examples (from basic to complex) of classes in various sections.
Code: Select all
<?php
// from the manual
class foo
{
function do_foo()
{
echo "Doing foo.";
}
}
$bar = new foo;
$bar->do_foo();
?>
Re: what is the meaning of :: in php?
Posted: Tue Aug 16, 2011 4:34 am
by ashiland
Thanks social_experiment!
Re: what is the meaning of :: in php?
Posted: Tue Aug 16, 2011 4:36 am
by phphelpme
Here is something for you to start off with if you are desperate to get hands on:
http://en.wikibooks.org/wiki/PHP_Programming/Classes
Best wishes
Re: what is the meaning of :: in php?
Posted: Tue Aug 16, 2011 4:57 am
by ashiland
Thanks again for your prompt reply,
actually I know the basics, I was looking for the more advanced lessons.
sometimes I get stuck when analyzing the things that happen within a piece of code containing classes, as if I know nothing about the classes. That's why I'm looking for a source explaining advanced lessons but in a simply and intelligible way.
Re: what is the meaning of :: in php?
Posted: Tue Aug 16, 2011 5:02 am
by phphelpme
Then try take a look at this site:
http://www.expertrating.com/courseware/ ... torial.asp
Checkout section/chapter 9 for Advanced Class Concepts
Best wishes
Re: what is the meaning of :: in php?
Posted: Tue Aug 16, 2011 5:09 am
by ashiland
sounds great, I didn't know about that website.
I'll start right away and I'll let you know if there's something I don't get.
Thanks for your help.
Regards.