[thelist] another php question: object reference syntax

Jonathan_A_McPherson at rl.gov Jonathan_A_McPherson at rl.gov
Wed Jul 17 16:09:01 CDT 2002


> Ok, that makes sense. I seem to remember this talk about pointers
> when going through a Java class, and you often see those caveats in
> Java books (at least that I have read.) Coming from Java/JavaScript
> it seemed odd.
>
> So - I CAN use dot syntax, but if I make a pointer, I have to use ->
> correct?

I don't know a great deal about Java. If I recall correctly, it doesn't have
pointers in the C sense of the word. In C, a pointer is a memory address.
Java, attempting to do away with such down-to-the-hardware specifics to make
a more abstract VM, abandoned memory pointers.

I suspect that Java and PHP have object references, and by this I mean an
object that is really just a reference to a different object. For instance:

Copy object (use .)

+---+     +---+
| x |     | y |
+---+     +---+

Reference object (use ->)

+---+
| x | <---- y
+---+

I don't know enough PHP to know which operations generate actual copies and
which operations generate references. PHP wizards -- I know you're out
there!

--
Jonathan McPherson, LMIT/SD&I
Software Engineer & Web Systems Analyst
email / jonathan_a_mcpherson at rl dot gov



More information about the thelist mailing list