By philosophe on
i mean, specifically, the "->"?
i don't see that in PHP documentation, nor anyplace in the drupal documentation i can find.
it's not exactly easy to search the forums on that string ;)
thanks,
--derek
i mean, specifically, the "->"?
i don't see that in PHP documentation, nor anyplace in the drupal documentation i can find.
it's not exactly easy to search the forums on that string ;)
thanks,
--derek
Comments
$user is an object
It's an element access syntax also used by Perl. See the docs:
http://www.php.net/manual/en/language.oop.php
You meant php, not perl :)
$user->uid is the user id of the user represented by the $user object. Note that $user is also a global variable so
global $user;
print $user->uid
will print the uid of the currently logged in user.
I meant Perl
Both PHP and Perl use the -> syntax for accessing object elements and functions. It is also used in C++ when you have a pointer to an object rather than the object itself.
In non techie speak...
It means 'inside'. so the uid var is inside the 'user' var.
Close. to be more precise,
Close. to be more precise, "->" means property y in object x, eg x->y
See Objects and classes (php4)
--
Gordon Heydon
Heydon Consulting
--
Gordon Heydon
thanks, question answered!
i appreciate the responses. This is the information i needed.
-- derek