Jump to content

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

?>

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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