The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
PHP question
Hi,
I've gone thru the PHP Tutorial on W3 and I've not seen reference to things such as "$vbulletin->GPC['moderatorid']". Can anyone tell me what this operator (->) does ?? |
#2
|
|||
|
|||
I'm not the best at explaining but these are sorta custom vBulletin commands.
-> sorta means this or next So in the example you gave it's vbulletin this GCP GCP is like a clean function so it's cleaning the contents of moderatorid moderatorid is a varable which in this case is a number and represents the id number. So the line you gave means "vBulletin this clean moderatorid" Hope you follow me. As I said I'm not the best at explaining this sorta stuff. |
#3
|
|||
|
|||
I'm not sure what the technical term for it is but it's used for PHP's OOP (object-oriented programming). $vbulletin is a class and to access that classes members (variables of the class) or functions you can use the -> operator. So that just means that GPC['moderatorid'] is a member of the $vbulletin class. Quite a few programming languages use the same operator for this purpose.
EDIT: Posted this before seeing Happy's response. I'm not really sure that's a valid response. I don't know much about vBulletin itself/their functions etc but as far as I can tell the GPC there isn't a function it's just an array. I'm presuming this clean function that you mention sets this array up though. Plus I certainly weren't aware of -> being a custom vB command lol. It's part of PHP's programming language. |
#4
|
|||
|
|||
Sorry I know that is -> OOP isn't custom to vBulletin. I was refering to the whole $vbulletin->GPC command. As I said I'm not great at explaining things and was trying to explain it in simple English. If inenigma was using W3schools for tutorials I presumed he wanted it in an extremely simple English explanation. Sorry.
|
#5
|
||||
|
||||
Quote:
|
#6
|
|||
|
|||
API documentation is available through the member control panel at
http://members.vbulletin.com/api/index.html |
#7
|
||||
|
||||
Quote:
|
#8
|
|||
|
|||
If you had a database class that contained functions to do with a database (I'm not going to write it).
Your class is $db. 1 function is clean() to sanitise inputs for databases. 1 function is insert() to insert inputs into the database. 1 function is select() to select from the database. Now, because these are contained in the $db class, we can access these functions as a child property of that class, by using the (->) operator. $db->clean($_POST['somestuff']); $db->insert($_POST['somestuff']); I'm sorry if that didn't help, as Attilitus said it's used to access methods and variables that are stored inside your class. |
#9
|
||||
|
||||
Quote:
Thanks Guys |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|