what is the meaning of :: in php?
Moderator: General Moderators
what is the meaning of :: in php?
please explain the codes bellow :
Plugins::init() ;
Rewrite::newInstance()->init();
Session::newInstance()->session_start() ;
many thanks in advance!
Plugins::init() ;
Rewrite::newInstance()->init();
Session::newInstance()->session_start() ;
many thanks in advance!
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: what is the meaning of :: in php?
It the scope resolution operator.
Not too sure about the last two 
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() ;
?>“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: what is the meaning of :: in php?
thanks indeed for your great help!
I didn't even know how it was called otherwise I would have searched for it.
Thanks again.
I didn't even know how it was called otherwise I would have searched for it.
Thanks again.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: what is the meaning of :: in php?
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 ->.
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 ->.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: what is the meaning of :: in php?
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.
Accurate answer ! many thanks.
Re: what is the meaning of :: in php?
does anyone know any good source to study classes?
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: what is the meaning of :: in php?
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.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: what is the meaning of :: in php?
Is it for free?
Re: what is the meaning of :: in php?
Hurry up please, I'm desperate to learn the classes.
I just need something simple with a lot of examples
I just need something simple with a lot of examples
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: what is the meaning of :: in php?
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.ashiland wrote:I just need something simple with a lot of examples
Code: Select all
<?php
// from the manual
class foo
{
function do_foo()
{
echo "Doing foo.";
}
}
$bar = new foo;
$bar->do_foo();
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: what is the meaning of :: in php?
Thanks social_experiment!
Re: what is the meaning of :: in php?
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
http://en.wikibooks.org/wiki/PHP_Programming/Classes
Best wishes
Re: what is the meaning of :: in php?
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.
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?
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
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?
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.
I'll start right away and I'll let you know if there's something I don't get.
Thanks for your help.
Regards.