RyGuy
RyGuy

Reputation: 508

How to structure an array

I have to figure out how to present some data that is capture using gravity forms for wordpress.

There is a field for name, and attributes. Attributes contains a comma delineated list of values.

On a results page I need to display the names, followed by the top ten values. Where I'm stuck is is how to configure an array that gives me: distinct names, and within each distinct name is an array containing all values from the comma list(s).

I can't wrap my head around this to save my life. Given how GF stores enteries I think makes this especially difficult. Any guidance is much appreciated.

Upvotes: 0

Views: 67

Answers (1)

Joshua Wilson
Joshua Wilson

Reputation: 2526

<?php
// A two-dimensional array:
$names = array
  (
  "sam"=>array(1,2,3,4,5,6,7,8,9,10),
  "joe"=>array(1,2,3,4,5,6,7,8,9,10),
  "bob"=>array(1,2,3,4,5,6,7,8,9,10)
  );
?>

Like that?

Upvotes: 1

Related Questions