Jump to content

What does 'skillswidget:red' => 'red' mean?


nrerup

Recommended Posts

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 ...

Link to comment
https://forums.phpfreaks.com/topic/162819-what-does-skillswidgetred-red-mean/
Share on other sites

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'];

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.