nrerup Posted June 18, 2009 Share Posted June 18, 2009 I've just started teaching myself PHP (it's been 25 years since I've done any coding, so my apologies beforehand) and I'm trying to understand a widget that I found in Elgg (I would like to customize the widget). My question is probably very basic but here goes anyway... I see this type of entry in many different PHP files so I'm trying to understand the specific action associated with this type of line. The line in question reads along the lines of: 'skillswidget:red' => 'red' The widget itself is called 'skillswidget' so I'm assuming that the 'skillswidget:red' indicates that red is a variable in the skillswidget widget. Is this correct? If that is so, does the line above mean that the value of 'red' is assigned to 'skillswidget:red' ? I haven't been able to find any reference to this type of coding in any PHP text so far, so if you could point me to additional references, I'd appreciate it ... Quote Link to comment https://forums.phpfreaks.com/topic/162819-what-does-skillswidgetred-red-mean/ Share on other sites More sharing options...
Maq Posted June 18, 2009 Share Posted June 18, 2009 It's just an associative array. Here, learning by example is probably the best in this case. $example = array('skillswidget:red' => 'red', 'skillswidget:blue' => 'blue', 'skillswidget:black' => 'black'); // This will output the entire array print_r($example); // Print out a single element echo "Color: " . $example['skillswidget:black']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/162819-what-does-skillswidgetred-red-mean/#findComment-859200 Share on other sites More sharing options...
nrerup Posted June 18, 2009 Author Share Posted June 18, 2009 Much appreciated. I'll research based on that term ... Quote Link to comment https://forums.phpfreaks.com/topic/162819-what-does-skillswidgetred-red-mean/#findComment-859242 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.