Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8685363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:33:07+00:00 2026-06-12T22:33:07+00:00

I’m trying to turn a huge configuration array in PHP, that looks like this

  • 0

I’m trying to turn a huge configuration array in PHP, that looks like this

$config['festival'] = 
array
(
    'title' => 'USF Tango Festival',
    'tableLayout' => array
    (
        'registration' => array
        (
            array('firstName','text'),
            array('lastName','text'),
            array('phone','text'),
            array('email','text'),
            array('hearAboutFestival','text'),
            array('danceAs','enum(\'Leader\', \'Follower\', \'Both\')'),
            array('student','tinyint(1)')
        ),
        'experience' => array
        (
            array('options','text'),
            array('lunchMeat','enum(\'Ham\',\'Turkey\',\'Vegetarian\')'),
            array('lunchBread','enum(\'White\',\'Wheat\')'),
            array('dinnerPref','enum(\'Chicken\',\'Beef\',\'Vegetarian\')')
        )
    ),
    'pageLayout' => array
    (
        'registration' => array
        (
            'jqueryRules' =>
<<<EOT
    'firstName': 'required',
    'lastName': 'required',
    'phone': {
        required: true,
        phoneUS: true
    },
    'email': {
        required: true,
        email: true
    },
    'danceAs': 'required',
    'partner': 'required',
    'partnerMatching': {
        required: function() {
            return $("input[name='partner']").val() == 0;
        }
    },
    'partnerName': {
        required: function() {
            return $("input[name='partner']").val() == 1;
        }
    }
EOT
    ,
        'inputs' => array
        (
            array
            (
                'type' => 'text',
                'name' => 'firstName',
                'fullName' => 'First Name',
                'required' => true,
                'separateDiv' => false
            ),
            array
            (
                'type' => 'text',
                'name' => 'lastName',
                'fullName' => 'Last Name',
                'required' => true,
                'separateDiv' => false
            ),
            array
            (
                'type' => 'text',
                'name' => 'phone',
                'fullName' => 'Phone number',
                'required' => true,
                'separateDiv' => false
            ),
            array
            (
                'type' => 'text',
                'name' => 'email',
                'fullName' => 'Email address',
                'required' => true,
                'separateDiv' => false
            ),
            array
            (
                'type' => 'text',               
                'name' => 'hearAboutFestival',
                'separateDiv' => false,
                'fullName' => 'How did you hear about the festival?',
                'required' => false
            ),
            array
            (
                'type' => 'select',
                'name' => 'danceAs',
                'fullName' => 'You dance as a...',
                'required' => true,
                'separateDiv' => false,
                'options' => array(array('leader','Leader'),array('follower','Follower'),array('both','Both'))
            ),
            array
            (
                'type' => 'checkbox',
                'name' => 'student',
                'value' => '1',
                'separateDiv' => false,
                'fullName' => 'I am a student',
                'required' => false
            )
        )
    )

and

'options' => array
(
    'busMilonga' => array
    (
        'price' => 20,
        'student' => false,
        'name' => 'Tango on the Town Bus milonga',
        'description' => 'A bus milonga!'
    ),
    'thursdayMilonga' => array
    (
        'price' => 10,
        'student' => false,
        'name' => 'Thursday Kickoff Milonga',
        'description' => 'The un-official kick off milonga!'
    ),
    'saturdayPass' => array
    (
        'price' => 90,
        'student' => true,
        'name' => 'Saturday pass',
        'description' => 'Includes all Saturday workshops and milongas'
    ),
    'sundayPass' => array
    (
        'price' => 80,
        'student' => true,
        'name' => 'Sunday pass',
        'description' => 'Includes all Sunday workshops, the jam session, and milonga'
    ),
    'milongaPass' => array
    (
        'price' => 70,
        'earlyBird' => 50, //array(50,60),
        'student' => true,
        'name' => 'Milonga Pass',
        'description' => 'Includes entrance to all night milongas'
    ),
    'dinnerPass' => array
    (
        'price' => 20,
        'student' => false,
        'name' => 'Dinner pass',
        'description' => 'Includes Saturday dinner'
    ),
    'lunchPass' => array
    (
        'price' => 10,
        'student' => false,
        'name' => 'Saturday lunch',
        'description' => 'Includes lunch on Saturday'
    )
),
'info' => array
(
    'instructors' => array('Instructors'),
    'hour' => array('10','11','12','01','02','03'),
    'min' => array('15','30','45','00'),
    'tod' => array('AM','PM'),
    'day' => array('Friday','Saturday','Sunday'),
    'level' => array('Beginner','Intermediate','Advanced'),
    'place' => array('REC 107','REC 033','REC 005'),
    'sessions' => array
    (
        3, // days
        array
        (
            'Friday', // day name
            3, // sessions on this day
            array
            (
                3, // workshops in session
                '1100AM' // time
            ), 
            array
            (
                3, 
                '0100PM' 
            ), 
            array
            (
                1,
                '0230PM'
            ) // 1,4
        ),
        array('Saturday', // 2,0
            3, // 2,1
            array(1,'1030AM'), //2,2
            array(3,'1145AM'), // 2,3
            array(3,'0145PM') // 2,4
        ),
        array
        (
            'Sunday', // 3,0
            3, // 3,1
            array(1,'1115AM'), // 3,2
            array(3,'1230PM'), // 3,3
            array(3,'0230PM') // 3,4
        )
    )
)

into a database. I’m thinking I could make a few tables, titled something like config.event.festival but then it would get cumbersome since I would have to create a table for each array under the array…

I want to avoid using JSON encoding or serializing, so that I keep the data all relational and clean looking but I don’t know any other way other than just keeping one big configuration file rather than a database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:33:08+00:00Added an answer on June 12, 2026 at 10:33 pm

    Assuming the sample you provided represents a truncated view of your whole data structure, this could be done with three tables.

    festival

    • festival_id
    • title

    layout

    • layout_id
    • festival_id
    • layout_type_id
    • type
    • name
    • fullName
    • required
    • separateDiv

    layout_type

    • layout_type_id
    • name

    The festival table would keep your high-level meta data about the event page. The layout table would contain meta data about each of the elements on the page. And finally, the layout_type table would allow you to identify different element types that should be on a given page.

    This should get you started and allow you to modify as necessary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I would like to count the length of a string with PHP. The string
I know there's a lot of other questions out there that deal with this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.