473,581 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6195
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.c om> wrote in news:1110097485 .547798.187980
@g14g2000cwa.go oglegroups.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.paamayi m-nekudotayim.php >

hth
--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fu ng.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.c om> wrote in news:1110097485 .547798.187980
@g14g2000cwa.go oglegroups.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.paamayi m-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************ **********@g14g 2000cwa.googleg roups.com>,
ba****@gmail.co m 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
7682
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. Thanks alot.
11
13107
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
18750
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
9629
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 9,223,372,036,854,775,807. But I'm not good with the E+??? notation so when I'm told double holds -1.79769313486231570E+308 through -4.94065645841246544E-324 for negative...
67
9867
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 quesion. I have begun to familiarize myself here with the gcc compiler in a win32 environment, in the form of MinGW using both Dev C++ and MSYS as...
60
7176
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
5292
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
3694
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 to serialize doubles in human-readable decimal form and be sure I get the exact same binary values when I read them back. (Right now, I don't care...
248
1510
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) It then updates the value with numberOfPrecisions after the decimal
15
3019
by: broli | last post by:
Is this a part of C 99 or just an addon in some windows compilers like pellesC ?
0
7868
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8304
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8175
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5364
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3805
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1403
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1138
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.