473,388 Members | 1,340 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Double Dot Means what ::

Hi friends

I'm still exploring in PHP programming with little knowledge on C ..
the mother of programming language..

Just wonder .. some times we will see some pepole use :: singn in
their code
and what it mean ?
for e.g Get::message ; <-- what the :: means.. is it some conditional
statement
because i saw a lot in Pear stlyle of coding..

Jul 17 '05 #1
8 6179
badz wrote:
I'm still exploring in PHP programming with little knowledge on C ..
the mother of programming language..

Just wonder .. some times we will see some pepole use :: singn in
their code
and what it mean ?

for e.g Get::message ; <-- what the :: means.. is it some conditional
statement
because i saw a lot in Pear stlyle of coding..


It's a way of calling a method in a class without actually creating an
object; but because you haven't created the object you don't have
access to any of the properties that might have already been set.
Example:

class foo {

var $abc = '123';

function bar() {
print $this->abc;
}

}

You can call the method bar() like this:

$foo = new foo();
$foo->bar();

OR like this:

foo::bar();

Calling it like $foo->bar(); will print out '123' but foo::bar(); will
not. And depending on your level of error reporting, calling foo::bar()
in the above example will show an "undefined variable" error message.

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #2
"badz" <ba****@gmail.com> wrote in news:1110097485.547798.187980
@g14g2000cwa.googlegroups.com:
Hi friends

I'm still exploring in PHP programming with little knowledge on C ..
the mother of programming language..

Just wonder .. some times we will see some pepole use :: singn in
their code
and what it mean ?
for e.g Get::message ; <-- what the :: means.. is it some conditional
statement
because i saw a lot in Pear stlyle of coding..


:: is the scope resolution operator, part of PHP's object oriented
implementation. It allows you to access properties and methods of a
class, even if you haven't instantiated a member of the class. Have a
look at:

<http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php>

hth
--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fung.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources
Jul 17 '05 #3
Chris Hope wrote:
badz wrote:
I'm still exploring in PHP programming with little knowledge on C ..
the mother of programming language..

Just wonder .. some times we will see some pepole use :: singn in
their code
and what it mean ?

for e.g Get::message ; <-- what the :: means.. is it some
conditional statement
because i saw a lot in Pear stlyle of coding..


It's a way of calling a method in a class without actually creating an
object; but because you haven't created the object you don't have
access to any of the properties that might have already been set.
Example:

class foo {

var $abc = '123';

function bar() {
print $this->abc;
}

}

You can call the method bar() like this:

$foo = new foo();
$foo->bar();

OR like this:

foo::bar();

Calling it like $foo->bar(); will print out '123' but foo::bar(); will
not. And depending on your level of error reporting, calling
foo::bar() in the above example will show an "undefined variable"
error message.


And the manual has some info about it here:
http://www.php.net/manual/en/keyword...ekudotayim.php

--
Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #4
Senator Jay Billington Bulworth wrote:
"badz" <ba****@gmail.com> wrote in news:1110097485.547798.187980
@g14g2000cwa.googlegroups.com:

Hi friends

I'm still exploring in PHP programming with little knowledge on C ..
the mother of programming language..

Just wonder .. some times we will see some pepole use :: singn in
their code
and what it mean ?
for e.g Get::message ; <-- what the :: means.. is it some conditional
statement
because i saw a lot in Pear stlyle of coding..

:: is the scope resolution operator, part of PHP's object oriented
implementation. It allows you to access properties and methods of a
class, even if you haven't instantiated a member of the class. Have a
look at:

<http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php>

hth

essentially its a pseuedonym for $this->
Jul 17 '05 #5
NSpam wrote:
essentially its a pseuedonym for $this->


Not really, since this expects you to have created an instance of an object,
while Class::method can be used without prior object instantiation...
JW

Jul 17 '05 #6
.oO(NSpam)
essentially its a pseuedonym for $this->


Nope.

Micha
Jul 17 '05 #7
ok thank guys..
so its called Scope Resolution Operator . and widely used in OOP inside
PHP

Jul 17 '05 #8
ggg
In article <11**********************@g14g2000cwa.googlegroups .com>,
ba****@gmail.com says...
Hi friends

I'm still exploring in PHP programming with little knowledge on C ..
the mother of programming language..

Just wonder .. some times we will see some pepole use :: singn in
their code
and what it mean ?
for e.g Get::message ; <-- what the :: means.. is it some conditional
statement
because i saw a lot in Pear stlyle of coding..


You could think of it as, just calling that function w/o instantiating
the class that it's in.
Jul 17 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

33
by: Daniel Fadlun | last post by:
Is there a bigger, mathematical, data type in C than the double (64 bit) one or the old long double (80 bit)? I'd like to add precision to my mathematical application, but I can't figure out how....
11
by: gouqizi.lvcha | last post by:
Hi, All: I wonder what is the smallest positive double numbers in C in 32 bit CPU? Rick
10
by: Bryan Parkoff | last post by:
The guideline says to use %f in printf() function using the keyword float and double. For example float a = 1.2345; double b = 5.166666667; printf("%.2f\n %f\n", a, b);
14
by: cj | last post by:
VB2003. I need a large positive integer. Which is larger int64 or double? I see int64 also apparently is known as long and will hold -9,223,372,036,854,775,808 through...
67
by: lcw1964 | last post by:
This may be in the category of bush-league rudimentary, but I am quite perplexed on this and diligent Googling has not provided me with a clear straight answer--perhaps I don't know how to ask the...
60
by: Erick-> | last post by:
hi all... I've readed some lines about the difference between float and double data types... but, in the real world, which is the best? when should we use float or double?? thanks Erick
42
by: xdevel | last post by:
Hi, if I have: int a=100, b = 200, c = 300; int *a = {&a, &b, &c}; than say that: int **b is equal to int *a is correct????
11
by: Ole Nielsby | last post by:
First, sorry if this is off-topic, not strictly being a C++ issue. I could not find a ng on numerics or serialization and I figure this ng is the closest I can get. Now the question: I want...
248
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
15
by: broli | last post by:
Is this a part of C 99 or just an addon in some windows compilers like pellesC ?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.