Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Created September 7, 2012 12:42
Show Gist options
  • Select an option

  • Save objectivehtml/3665915 to your computer and use it in GitHub Desktop.

Select an option

Save objectivehtml/3665915 to your computer and use it in GitHub Desktop.
<?php
$var = array(
array(
'name' => 'Some Name 1',
'value' => 'Some Value 1'
),
array(
'name' => 'Some Name 2',
'value' => 'Some Value 2'
),
array(
'name' => 'Some Name 3',
'value' => 'Some Value 3'
)
);
$var = $this->EE->channel_data->utility->reindex($var, 'name');
// Would return...
/*
$var = array(
'Some Name 1' => array(
'name' => 'Some Name 1',
'value' => 'Some Value 1'
),
'Some Name 2' => array(
'name' => 'Some Name 2',
'value' => 'Some Value 2'
),
'Some Name 3' => array(
'name' => 'Some Name 3',
'value' => 'Some Value 3'
)
);
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment