Some php questions
Posted: 18 July 2006 09:54 AM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  71
Joined  05-12-2006

I’m new-ish to php, and need to play around with some things in the EE files. So I have a few questions regarding php.

1) Whats $$variable mean?
2) What’s the question mark for?
3) What’s the -> do?

Example:

  $r .= $DSP->input_checkbox($val, ‘y’, ($$val == ‘y’) ? 1 : ‘’).NBS.$LANG->line($val);

I know coding, I just don’t know php super well yet.

Profile
 
 
Posted: 18 July 2006 10:16 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15346
Joined  05-15-2004

1. It’s a variable variable.
2. The so called ternary operator (if/else, basically)
3. Object oriented PHP. “DSP->input_checkbox” calls the function input_checkbox() of the class DSP. You might want to read up on it grin

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 26 July 2006 08:25 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  78
Joined  05-12-2006

3. More specifically, -> is an object operator used to access the members of an object.  To be correct, $DSP->input_checkbox() accesses the input_checkbox() method (or function if you prefer) of the object held in the variable $DSP, not the class DSP.  To directly access members of a class without creating an object, you’d use the Paamayim Nekudotayim operator, a.k.a the scope resolution operator, a.k.a the double colon, i.e. ClassName::methodName()

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64882 Total Logged-in Users: 69
Total Topics: 81808 Total Anonymous Users: 42
Total Replies: 439793 Total Guests: 319
Total Posts: 521601    
Members ( View Memberlist )
Newest Members:  Shrike67Dynamic1justingpticketjendicottdxrsmdanbilly8hrkiliwysso50kexpresso