By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,830 Members | 2,276 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,830 IT Pros & Developers. It's quick & easy.

get object name

P: n/a
How do I get an object's name?
EG.

$obj_FOO = new Bar;

echo $obj_FOO->getName();

'obj_FOO'

?

I am racking my brains.
Sep 18 '08 #1
Share this Question
Share on Google+
23 Replies


P: n/a

"Hugh Oxford" <ar*****@fas.comwrote in message
news:48**********************@news.zen.co.uk...
How do I get an object's name?
EG.

$obj_FOO = new Bar;

echo $obj_FOO->getName();

'obj_FOO'
Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have answers...in
TFM. Case in point:

<?php
function var_name(&$var, $scope = 0)
{
$old = $var;
if (
$key = array_search($var = 'unique'.rand().'value', !$scope ? $GLOBALS
: $scope) &&
$var = $old
)
{
return $key;
}
}
?>

HTH
Sep 18 '08 #2

P: n/a
Oscar Arreyano wrote:
Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have answers...in
TFM. Case in point:
Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.
Sep 18 '08 #3

P: n/a

"Hugh Oxford" <ar*****@fas.comwrote in message
news:48**********************@news.zen.co.uk...
Oscar Arreyano wrote:
>Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have
answers...in TFM. Case in point:

Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought of
an object as a variable, because you cannot change the value of it. So I
hope you can understand my confusion.
You owe me no respect, but thanks. The name of the class is Bar, yes. Class
is more of an adjective...a 'type' of object. A variable stores a reference
to an instance of an object, not the class which defines it. Either way, I
understand the confusion of not being able to find what you were looking
for. Knowing what to ask is the key. I'm glad we've got it all sorted out.
:)

Btw, the example given, strictly, will only work if globals are turned
on...which is bad. However, there are several php functions that don't rely
on that setting but will return all defined variables...They should be used
instead, IMO.

Cheers.
Sep 18 '08 #4

P: n/a
Oscar Arreyano wrote:
"Hugh Oxford" <ar*****@fas.comwrote in message
news:48**********************@news.zen.co.uk...
>Oscar Arreyano wrote:
>>Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have
answers...in TFM. Case in point:
Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought of
an object as a variable, because you cannot change the value of it. So I
hope you can understand my confusion.

You owe me no respect, but thanks. The name of the class is Bar, yes. Class
is more of an adjective...a 'type' of object. A variable stores a reference
to an instance of an object, not the class which defines it. Either way, I
understand the confusion of not being able to find what you were looking
for. Knowing what to ask is the key. I'm glad we've got it all sorted out.
:)

Btw, the example given, strictly, will only work if globals are turned
on...which is bad. However, there are several php functions that don't rely
on that setting but will return all defined variables...They should be used
instead, IMO.

Cheers.
No, an object is an instantiation of a class. But you never could
figure that one out, could you?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 19 '08 #5

P: n/a
Hugh Oxford wrote:
Oscar Arreyano wrote:
>Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see
some errors. As always, 90% of the questions asked here already have
answers...in TFM. Case in point:

Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.
Yes, an object is a variable because you can change it's value. In this
case the value would be the data members of the class.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 19 '08 #6

P: n/a
Hugh Oxford wrote:
How do I get an object's name?
EG.

$obj_FOO = new Bar;

echo $obj_FOO->getName();

'obj_FOO'

?

I am racking my brains.

http://bugs.php.net/bug.php?id=44282 ???

Sep 19 '08 #7

P: n/a

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org...
Oscar Arreyano wrote:
>"Hugh Oxford" <ar*****@fas.comwrote in message
news:48**********************@news.zen.co.uk...
>>Oscar Arreyano wrote:

Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have
answers...in TFM. Case in point:
Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.

You owe me no respect, but thanks. The name of the class is Bar, yes.
Class is more of an adjective...a 'type' of object. A variable stores a
reference to an instance of an object, not the class which defines it.
Either way, I understand the confusion of not being able to find what you
were looking for. Knowing what to ask is the key. I'm glad we've got it
all sorted out. :)

Btw, the example given, strictly, will only work if globals are turned
on...which is bad. However, there are several php functions that don't
rely on that setting but will return all defined variables...They should
be used instead, IMO.

Cheers.

No, an object is an instantiation of a class. But you never could figure
that one out, could you?
I wish you could r*e*a*d*, Jerry. Here's what I said:

<quote>
variable stores a reference to an instance of an object
</quote>

A class is the mechanics that define how the instantiated object will
behave.

How can one be your age and not be able to read? Maybe you need a new
prescription for your glasses? Either way, it's too bad you have to behave
like a child. You are an instance of an imbecile and you have *no* class.
Sep 19 '08 #8

P: n/a

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org...
Hugh Oxford wrote:
>Oscar Arreyano wrote:
>>Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have
answers...in TFM. Case in point:

Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought of
an object as a variable, because you cannot change the value of it. So I
hope you can understand my confusion.

Yes, an object is a variable because you can change it's value. In this
case the value would be the data members of the class.
An object is a NOT a variable. How long have you been programming?!!!

$i

What methods can i enact on $i? none.

$i = 'Oh my!';

Did I pick up any interfaces yet? Maybe in javascript, perl, or .Net...but
not in php.

A variable is a reference to something in memory, be it a literal reference,
pointer, or copy of something. A variable is NOT an object.

Dunce!
Sep 19 '08 #9

P: n/a
Oscar Arreyano wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org...
>Oscar Arreyano wrote:
>>"Hugh Oxford" <ar*****@fas.comwrote in message
news:48**********************@news.zen.co.uk.. .
Oscar Arreyano wrote:

Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have
answers...in TFM. Case in point:
Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.
You owe me no respect, but thanks. The name of the class is Bar, yes.
Class is more of an adjective...a 'type' of object. A variable stores a
reference to an instance of an object, not the class which defines it.
Either way, I understand the confusion of not being able to find what you
were looking for. Knowing what to ask is the key. I'm glad we've got it
all sorted out. :)

Btw, the example given, strictly, will only work if globals are turned
on...which is bad. However, there are several php functions that don't
rely on that setting but will return all defined variables...They should
be used instead, IMO.

Cheers.
No, an object is an instantiation of a class. But you never could figure
that one out, could you?

I wish you could r*e*a*d*, Jerry. Here's what I said:

<quote>
variable stores a reference to an instance of an object
</quote>

A class is the mechanics that define how the instantiated object will
behave.

How can one be your age and not be able to read? Maybe you need a new
prescription for your glasses? Either way, it's too bad you have to behave
like a child. You are an instance of an imbecile and you have *no* class.
Yes, I read what you said - and you got it wrong (again).

There is no such thing as an "instance of an object". An object exists
or it doesn't exist. Objects are instances of a class.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 19 '08 #10

P: n/a
Oscar Arreyano wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org...
>Hugh Oxford wrote:
>>Oscar Arreyano wrote:

Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see some
errors. As always, 90% of the questions asked here already have
answers...in TFM. Case in point:
Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought of
an object as a variable, because you cannot change the value of it. So I
hope you can understand my confusion.
Yes, an object is a variable because you can change it's value. In this
case the value would be the data members of the class.

An object is a NOT a variable. How long have you been programming?!!!
Over 40 years. How long have you been programming? 40 days?
$i

What methods can i enact on $i? none.
It depends on the type of the variable.
$i = 'Oh my!';

Did I pick up any interfaces yet? Maybe in javascript, perl, or .Net...but
not in php.
In a broad sense, yes. You can perform concatenation on it, for
instance. If you had $i=3; you could perform other operations on it
such as addition, subtraction...

$i = new myObject().

Now $i is an object.
A variable is a reference to something in memory, be it a literal reference,
pointer, or copy of something. A variable is NOT an object.

Dunce!
If you want to go to that level, then there is no such thing as a
variable, an object or anything else. Everything is just things in memory.

But intelligent programmers don't think that way.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 19 '08 #11

P: n/a

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gb**********@registered.motzarella.org...
Oscar Arreyano wrote:
>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org...
>>Oscar Arreyano wrote:
"Hugh Oxford" <ar*****@fas.comwrote in message
news:48**********************@news.zen.co.uk. ..
Oscar Arreyano wrote:
>
>Actually what you want is the *variable* name. The object's name is
>Bar...and unless Bar has a method called 'getName', you should see
>some errors. As always, 90% of the questions asked here already have
>answers...in TFM. Case in point:
Thanks for your help.
>
With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.
You owe me no respect, but thanks. The name of the class is Bar, yes.
Class is more of an adjective...a 'type' of object. A variable stores a
reference to an instance of an object, not the class which defines it.
Either way, I understand the confusion of not being able to find what
you were looking for. Knowing what to ask is the key. I'm glad we've
got it all sorted out. :)

Btw, the example given, strictly, will only work if globals are turned
on...which is bad. However, there are several php functions that don't
rely on that setting but will return all defined variables...They
should be used instead, IMO.

Cheers.
No, an object is an instantiation of a class. But you never could
figure that one out, could you?

I wish you could r*e*a*d*, Jerry. Here's what I said:

<quote>
variable stores a reference to an instance of an object
</quote>

A class is the mechanics that define how the instantiated object will
behave.

How can one be your age and not be able to read? Maybe you need a new
prescription for your glasses? Either way, it's too bad you have to
behave like a child. You are an instance of an imbecile and you have *no*
class.

Yes, I read what you said - and you got it wrong (again).

There is no such thing as an "instance of an object". An object exists or
it doesn't exist. Objects are instances of a class.
A class is a blue-print. An object is what the computer builds from said
blue-print. An object is material in memory when constructed...therefore, it
is *instanciated*. Blue-prints are nothing more than computer directives.
While losely considered, an object *is* sometimes called an instance of a
class. However, NONE of that is what I contend!!! Which is why I said YOU
CAN'T READ!!!

I merely said, yet one more time for the eternally clueless, a *variable* is
a reference to an instance of an object. Provide me ONE piece of literature
that agrees with YOU that objects HAVE NO INSTANCES. Just one, Jerry!
Whether or not you consider an object to be an instance of a class or just
the computer's product from a blue-print is COMPLETELY IMMATERIAL.

Learn to read...once you do that, learn to program!
Sep 19 '08 #12

P: n/a

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gb**********@registered.motzarella.org...
Oscar Arreyano wrote:
>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org...
>>Hugh Oxford wrote:
Oscar Arreyano wrote:

Actually what you want is the *variable* name. The object's name is
Bar...and unless Bar has a method called 'getName', you should see
some errors. As always, 90% of the questions asked here already have
answers...in TFM. Case in point:
Thanks for your help.

With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.

Yes, an object is a variable because you can change it's value. In this
case the value would be the data members of the class.

An object is a NOT a variable. How long have you been programming?!!!

Over 40 years. How long have you been programming? 40 days?
You obviously are a very slow learner in that case!
>$i

What methods can i enact on $i? none.

It depends on the type of the variable.

And the language you're using! Which IS the point!!! A variable IS NOT an
OBJECT. It may represent one, but it is NOT one.
>$i = 'Oh my!';

Did I pick up any interfaces yet? Maybe in javascript, perl, or
.Net...but not in php.

In a broad sense, yes. You can perform concatenation on it, for instance.
If you had $i=3; you could perform other operations on it such as
addition, subtraction...
NOT in ANY SENCE. I can concatentate, do math, or whatever on it because of
its TYPE!!! TYPE != OBJECT!!!

You should have spent some of you 40+ years 'programming' in actually
reading *about* programming. :)

$i = new myObject().

Now $i is an object.
>A variable is a reference to something in memory, be it a literal
reference, pointer, or copy of something. A variable is NOT an object.

Dunce!

If you want to go to that level, then there is no such thing as a
variable, an object or anything else. Everything is just things in
memory.
Not true! I cannot make an object point to another object unless it is of
the correct TYPE or has an interface to do so. You are simply building
strawmen now! A variable represents something in memory. Objects and data
types define what is IN memory and what outcomes will be produced when
consumed. It is harder to manipulate any of that without the use of
variables.

A variable is a PRONOUN for something else...*always*.

But intelligent programmers don't think that way.
'intelligent' programmers think very carefully about memory...others just
don't mind leaks. I now know the category in which you fit. That's to a
certainty. Prior to your first garblings, I thought you were just new and
naive when it came to programming.
Sep 19 '08 #13

P: n/a
..oO(Hugh Oxford)
>How do I get an object's name?
EG.

$obj_FOO = new Bar;

echo $obj_FOO->getName();

'obj_FOO'

?

I am racking my brains.
Question is why you need this?

Micha
Sep 19 '08 #14

P: n/a
Oscar Arreyano wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gb**********@registered.motzarella.org...
>Oscar Arreyano wrote:
>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org...
Oscar Arreyano wrote:
"Hugh Oxford" <ar*****@fas.comwrote in message
news:48**********************@news.zen.co.uk.. .
>Oscar Arreyano wrote:
>>
>>Actually what you want is the *variable* name. The object's name is
>>Bar...and unless Bar has a method called 'getName', you should see
>>some errors. As always, 90% of the questions asked here already have
>>answers...in TFM. Case in point:
>Thanks for your help.
>>
>With all due respect, the name of the class is Bar. I've never thought
>of an object as a variable, because you cannot change the value of it.
>So I hope you can understand my confusion.
You owe me no respect, but thanks. The name of the class is Bar, yes.
Class is more of an adjective...a 'type' of object. A variable stores a
reference to an instance of an object, not the class which defines it.
Either way, I understand the confusion of not being able to find what
you were looking for. Knowing what to ask is the key. I'm glad we've
got it all sorted out. :)
>
Btw, the example given, strictly, will only work if globals are turned
on...which is bad. However, there are several php functions that don't
rely on that setting but will return all defined variables...They
should be used instead, IMO.
>
Cheers.
No, an object is an instantiation of a class. But you never could
figure that one out, could you?
I wish you could r*e*a*d*, Jerry. Here's what I said:

<quote>
variable stores a reference to an instance of an object
</quote>

A class is the mechanics that define how the instantiated object will
behave.

How can one be your age and not be able to read? Maybe you need a new
prescription for your glasses? Either way, it's too bad you have to
behave like a child. You are an instance of an imbecile and you have *no*
class.
Yes, I read what you said - and you got it wrong (again).

There is no such thing as an "instance of an object". An object exists or
it doesn't exist. Objects are instances of a class.

A class is a blue-print. An object is what the computer builds from said
blue-print. An object is material in memory when constructed...therefore, it
is *instanciated*. Blue-prints are nothing more than computer directives.
While losely considered, an object *is* sometimes called an instance of a
class. However, NONE of that is what I contend!!! Which is why I said YOU
CAN'T READ!!!
That's right. And an object is an instance of a class. There is no
such thing as an instance of an object.
I merely said, yet one more time for the eternally clueless, a *variable* is
a reference to an instance of an object. Provide me ONE piece of literature
that agrees with YOU that objects HAVE NO INSTANCES. Just one, Jerry!
Whether or not you consider an object to be an instance of a class or just
the computer's product from a blue-print is COMPLETELY IMMATERIAL.

Learn to read...once you do that, learn to program!
Just about any of the OO literature by the recognized authorities out there.

But it's about your level of comprehension, Steve. You're just a
stoopid idiot.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 19 '08 #15

P: n/a

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gb**********@registered.motzarella.org...
Oscar Arreyano wrote:
>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gb**********@registered.motzarella.org...
>>Oscar Arreyano wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org.. .
Oscar Arreyano wrote:
>"Hugh Oxford" <ar*****@fas.comwrote in message
>news:48**********************@news.zen.co.uk. ..
>>Oscar Arreyano wrote:
>>>
>>>Actually what you want is the *variable* name. The object's name is
>>>Bar...and unless Bar has a method called 'getName', you should see
>>>some errors. As always, 90% of the questions asked here already
>>>have answers...in TFM. Case in point:
>>Thanks for your help.
>>>
>>With all due respect, the name of the class is Bar. I've never
>>thought of an object as a variable, because you cannot change the
>>value of it. So I hope you can understand my confusion.
>You owe me no respect, but thanks. The name of the class is Bar, yes.
>Class is more of an adjective...a 'type' of object. A variable stores
>a reference to an instance of an object, not the class which defines
>it. Either way, I understand the confusion of not being able to find
>what you were looking for. Knowing what to ask is the key. I'm glad
>we've got it all sorted out. :)
>>
>Btw, the example given, strictly, will only work if globals are
>turned on...which is bad. However, there are several php functions
>that don't rely on that setting but will return all defined
>variables...They should be used instead, IMO.
>>
>Cheers.
No, an object is an instantiation of a class. But you never could
figure that one out, could you?
I wish you could r*e*a*d*, Jerry. Here's what I said:

<quote>
variable stores a reference to an instance of an object
</quote>

A class is the mechanics that define how the instantiated object will
behave.

How can one be your age and not be able to read? Maybe you need a new
prescription for your glasses? Either way, it's too bad you have to
behave like a child. You are an instance of an imbecile and you have
*no* class.
Yes, I read what you said - and you got it wrong (again).

There is no such thing as an "instance of an object". An object exists
or it doesn't exist. Objects are instances of a class.

A class is a blue-print. An object is what the computer builds from said
blue-print. An object is material in memory when constructed...therefore,
it is *instanciated*. Blue-prints are nothing more than computer
directives. While losely considered, an object *is* sometimes called an
instance of a class. However, NONE of that is what I contend!!! Which is
why I said YOU CAN'T READ!!!

That's right. And an object is an instance of a class. There is no such
thing as an instance of an object.
Well, that's where you'd be wrong.
>I merely said, yet one more time for the eternally clueless, a *variable*
is a reference to an instance of an object. Provide me ONE piece of
literature that agrees with YOU that objects HAVE NO INSTANCES. Just one,
Jerry! Whether or not you consider an object to be an instance of a class
or just the computer's product from a blue-print is COMPLETELY
IMMATERIAL.

Learn to read...once you do that, learn to program!

Just about any of the OO literature by the recognized authorities out
there.
One example, Jerry. With all of that literature, I'm sure you'd have no
problem supplying me one cite.

Funny how If I'm programming in .Net (or a couple of other languages for
that matter), if I try to consume an UN-INSTANCIATED OBJECT, the error
message reads something like this:

"Object reference not set to an instance of an object."

I suppose you're come-back will be, "Well, that's microsoft for you!"

LOL.
But it's about your level of comprehension, Steve. You're just a stoopid
idiot.
My name is clearly visible on my posts. I'm not sure what you're talking
about here so, again, please have your prescription eye wear UPDATED, old
man!
Sep 19 '08 #16

P: n/a
..oO(Oscar Arreyano)
>A class is a blue-print. An object is what the computer builds from said
blue-print. An object is material in memory when constructed...therefore, it
is *instanciated*. Blue-prints are nothing more than computer directives.
While losely considered, an object *is* sometimes called an instance of a
class. However, NONE of that is what I contend!!! Which is why I said YOU
CAN'T READ!!!

I merely said, yet one more time for the eternally clueless, a *variable* is
a reference to an instance of an object. Provide me ONE piece of literature
that agrees with YOU that objects HAVE NO INSTANCES. Just one, Jerry!
Whether or not you consider an object to be an instance of a class or just
the computer's product from a blue-print is COMPLETELY IMMATERIAL.
You're contradicting yourself in these two paragraphs and should get
the terminology right before you offend others. There's no such thing
like an instance of an object, because the object _is_ the instance.

If you talk about an instance of an object, this would mean that the
object is the blue print from which the instance was created. Of course
this is nonsense, because the blue print is the class, from which the
actual objects/instances are created.

Micha
Sep 19 '08 #17

P: n/a
Oscar Arreyano wrote:
"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gb**********@registered.motzarella.org...
>Oscar Arreyano wrote:
>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:ga**********@registered.motzarella.org...
Hugh Oxford wrote:
Oscar Arreyano wrote:
>
>Actually what you want is the *variable* name. The object's name is
>Bar...and unless Bar has a method called 'getName', you should see
>some errors. As always, 90% of the questions asked here already have
>answers...in TFM. Case in point:
Thanks for your help.
>
With all due respect, the name of the class is Bar. I've never thought
of an object as a variable, because you cannot change the value of it.
So I hope you can understand my confusion.
>
Yes, an object is a variable because you can change it's value. In this
case the value would be the data members of the class.
An object is a NOT a variable. How long have you been programming?!!!
Over 40 years. How long have you been programming? 40 days?

You obviously are a very slow learner in that case!
ROFLMAO! As if YOU would know!
>>$i

What methods can i enact on $i? none.
It depends on the type of the variable.


And the language you're using! Which IS the point!!! A variable IS NOT an
OBJECT. It may represent one, but it is NOT one.
A variable is CONSIDERED AN OBJECT in all OO programming languages -
including PHP. But you don't understand that, do you, stoopid?
>>$i = 'Oh my!';

Did I pick up any interfaces yet? Maybe in javascript, perl, or
.Net...but not in php.
In a broad sense, yes. You can perform concatenation on it, for instance.
If you had $i=3; you could perform other operations on it such as
addition, subtraction...

NOT in ANY SENCE. I can concatentate, do math, or whatever on it because of
its TYPE!!! TYPE != OBJECT!!!

You should have spent some of you 40+ years 'programming' in actually
reading *about* programming. :)
No, a type is a TEMPLATE on how to create an object. You can't do
ANYTHING to a type.
>
>$i = new myObject().

Now $i is an object.
>>A variable is a reference to something in memory, be it a literal
reference, pointer, or copy of something. A variable is NOT an object.

Dunce!
If you want to go to that level, then there is no such thing as a
variable, an object or anything else. Everything is just things in
memory.

Not true! I cannot make an object point to another object unless it is of
the correct TYPE or has an interface to do so. You are simply building
strawmen now! A variable represents something in memory. Objects and data
types define what is IN memory and what outcomes will be produced when
consumed. It is harder to manipulate any of that without the use of
variables.
You really should learn some terminology.
A variable is a PRONOUN for something else...*always*.
And you need to go back to 7th grade English, also. "variable" is NOT a
"pronoun" in ANY language.

>
>But intelligent programmers don't think that way.

'intelligent' programmers think very carefully about memory...others just
don't mind leaks. I now know the category in which you fit. That's to a
certainty. Prior to your first garblings, I thought you were just new and
naive when it came to programming.
ROFLMAO! But I understand you. You think you have all the answers, but
you really know NOTHING.

*plonk*
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 19 '08 #18

P: n/a
..oO(Oscar Arreyano)
>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gb**********@registered.motzarella.org...
>>
That's right. And an object is an instance of a class. There is no such
thing as an instance of an object.

Well, that's where you'd be wrong.
>>I merely said, yet one more time for the eternally clueless, a *variable*
is a reference to an instance of an object. Provide me ONE piece of
literature that agrees with YOU that objects HAVE NO INSTANCES. Just one,
Jerry! Whether or not you consider an object to be an instance of a class
or just the computer's product from a blue-print is COMPLETELY
IMMATERIAL.

Learn to read...once you do that, learn to program!

Just about any of the OO literature by the recognized authorities out
there.

One example, Jerry. With all of that literature, I'm sure you'd have no
problem supplying me one cite.

Funny how If I'm programming in .Net (or a couple of other languages for
that matter), if I try to consume an UN-INSTANCIATED OBJECT, the error
message reads something like this:

"Object reference not set to an instance of an object."

I suppose you're come-back will be, "Well, that's microsoft for you!"
Something like that. But I wouldn't blame it on MS alone. In early
Pascal there was an 'object' type, and the things created from it where
the instances. So there you could indeed talk about instances of an
object. They fixed the naming with Object Pascal/Delphi.

But given that error message, you would have _three_ independent things
instead of just two as in "normal" OOP: an object, an instance and the
class. Please explain how these _three_ things relate to each other.

Micha
Sep 19 '08 #19

P: n/a

"Michael Fesser" <ne*****@gmx.dewrote in message
news:2t********************************@4ax.com...
.oO(Oscar Arreyano)
>>"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:gb**********@registered.motzarella.org...
>>>
That's right. And an object is an instance of a class. There is no
such
thing as an instance of an object.

Well, that's where you'd be wrong.
>>>I merely said, yet one more time for the eternally clueless, a
*variable*
is a reference to an instance of an object. Provide me ONE piece of
literature that agrees with YOU that objects HAVE NO INSTANCES. Just
one,
Jerry! Whether or not you consider an object to be an instance of a
class
or just the computer's product from a blue-print is COMPLETELY
IMMATERIAL.

Learn to read...once you do that, learn to program!

Just about any of the OO literature by the recognized authorities out
there.

One example, Jerry. With all of that literature, I'm sure you'd have no
problem supplying me one cite.

Funny how If I'm programming in .Net (or a couple of other languages for
that matter), if I try to consume an UN-INSTANCIATED OBJECT, the error
message reads something like this:

"Object reference not set to an instance of an object."

I suppose you're come-back will be, "Well, that's microsoft for you!"

Something like that. But I wouldn't blame it on MS alone. In early
Pascal there was an 'object' type, and the things created from it where
the instances. So there you could indeed talk about instances of an
object. They fixed the naming with Object Pascal/Delphi.

But given that error message, you would have _three_ independent things
instead of just two as in "normal" OOP: an object, an instance and the
class. Please explain how these _three_ things relate to each other.
There are still only _two_ things. A class, which is the blue-print, from
which a computer will build an object, the 'instance' of the class in the
more general sense.

This is not limited to just *class* objects you know. That is why is
originally described a 'class' as an _adjective_, a type of object.
Structures, Enums, Arrays, even Strings in some languages are all constructs
of most languages. They are NOT classes. They ARE objects.

All I want, with such loosely thrown about nomenclature, is for Jerry to
show me ONE piece of literature that justifies not only HIS position, but
his compelling measure of hubris in saying I'm wrong (much less the other
insults he's happy to throw about).
Sep 19 '08 #20

P: n/a
..oO(Oscar Arreyano)
>"Michael Fesser" <ne*****@gmx.dewrote in message
news:2t********************************@4ax.com.. .
>>
Something like that. But I wouldn't blame it on MS alone. In early
Pascal there was an 'object' type, and the things created from it where
the instances. So there you could indeed talk about instances of an
object. They fixed the naming with Object Pascal/Delphi.

But given that error message, you would have _three_ independent things
instead of just two as in "normal" OOP: an object, an instance and the
class. Please explain how these _three_ things relate to each other.

There are still only _two_ things. A class, which is the blue-print, from
which a computer will build an object, the 'instance' of the class in the
more general sense.
Exactly.

Now the only question left is "what is an instance of an object", if
both mean the same as in this case? That's where all this arguing came
from initially. Given the correct description above, it simply doesn't
make any sense. How can something be an instance of itself?
>This is not limited to just *class* objects you know. That is why is
originally described a 'class' as an _adjective_, a type of object.
Structures, Enums, Arrays, even Strings in some languages are all constructs
of most languages. They are NOT classes. They ARE objects.
Sure, no question here.

Micha
Sep 19 '08 #21

P: n/a

"Michael Fesser" <ne*****@gmx.dewrote in message
news:28********************************@4ax.com...
.oO(Oscar Arreyano)
>>"Michael Fesser" <ne*****@gmx.dewrote in message
news:2t********************************@4ax.com. ..
>>>
Something like that. But I wouldn't blame it on MS alone. In early
Pascal there was an 'object' type, and the things created from it where
the instances. So there you could indeed talk about instances of an
object. They fixed the naming with Object Pascal/Delphi.

But given that error message, you would have _three_ independent things
instead of just two as in "normal" OOP: an object, an instance and the
class. Please explain how these _three_ things relate to each other.

There are still only _two_ things. A class, which is the blue-print, from
which a computer will build an object, the 'instance' of the class in the
more general sense.

Exactly.

Now the only question left is "what is an instance of an object", if
both mean the same as in this case? That's where all this arguing came
from initially. Given the correct description above, it simply doesn't
make any sense. How can something be an instance of itself?
>>This is not limited to just *class* objects you know. That is why is
originally described a 'class' as an _adjective_, a type of object.
Structures, Enums, Arrays, even Strings in some languages are all
constructs
of most languages. They are NOT classes. They ARE objects.

Sure, no question here.
Listen, my English is not the best, but I'm trying. Let me see if i can be
absolutely, technically accurate with all of this...

A class, really, is just a data type just as are structures (et. al.). So
this is what i mean by 'instance of an object'.

foo myFooVar;
myFooVar = new foo();

I am telling the compiler that myFooVar is strongly-typed as *type* foo. I
am then having it create an instance of foo. While there is a gray area here
as to whether or not the instance is the *class* foo or the object
instanciated is of *type* foo, *that* is the question. In most languages I
use, foo is merely a data type...telling the compiler that the variable is
an object type (which could make the compiler/language interpreter/whatever
force other constraints on the instance of the created object, such as
forcing it to inherit from a base class common to all 'objects' for the
language). Secondarily, the specifics of foo are made into an *instance of
an object of type foo*.

If there is some other work you can cite that disagrees with this, I'd
really love to see it. I'm fine admitting when I'm wrong, but I certainly
can't stand for unsupported and uneducated theoritical bashing (Jerry, not
you). I may be wrong. I just need to know I'm wrong for better reasons than
Jerry didn't like me posting off-topic questions. :)

Cheers Michael.
Sep 19 '08 #22

P: n/a
..oO(Oscar Arreyano)
>Listen, my English is not the best, but I'm trying. Let me see if i can be
absolutely, technically accurate with all of this...

A class, really, is just a data type just as are structures (et. al.). So
this is what i mean by 'instance of an object'.

foo myFooVar;
myFooVar = new foo();

I am telling the compiler that myFooVar is strongly-typed as *type* foo. I
am then having it create an instance of foo. While there is a gray area here
as to whether or not the instance is the *class* foo or the object
instanciated is of *type* foo, *that* is the question.
I don't think that's a question. For me a class is a type, simply the
description or blue print of something. And the object/instance is the
thing that's created from that description. So I don't see any gray area
there: "the instance is the *class* foo" doesn't make any sense to me,
while "the object instanciated is of *type* foo" perfectly fits.
>In most languages I
use, foo is merely a data type...
Yep.
>telling the compiler that the variable is
an object type
Yep.
>(which could make the compiler/language interpreter/whatever
force other constraints on the instance of the created object, such as
forcing it to inherit from a base class common to all 'objects' for the
language). Secondarily, the specifics of foo are made into an *instance of
an object of type foo*.
But here you've lost me again. IMHO you're still describing _three_
different things, while in fact there are only two. What's the
difference between the instance and the object?

Your code snippet from above simply does two things: It declares a
variable that's supposed to be of type 'foo', whatever kind of type that
would be. The second line just creates something of that type (an object
in this case) and assigns it to the variable. So where's the distinction
in object and instance coming from? That's the one thing I still don't
get. I can't even try to explain it in a logical way.

Micha
Sep 19 '08 #23

P: n/a
Michael Fesser wrote:
.oO(Hugh Oxford)
>How do I get an object's name?
EG.

$obj_FOO = new Bar;

echo $obj_FOO->getName();

'obj_FOO'

?

I am racking my brains.

Question is why you need this?

Micha
I would venture to say if he wanted to echo out the Object name for
whatever reason. I'm guessing of course.

Scotty
Sep 19 '08 #24

This discussion thread is closed

Replies have been disabled for this discussion.