0

I have multiple arrays:

$meta_boxes[] = array(
    'id' => 'measurements',
    'title' => 'Measurements',
    'fields' => array(  
        array(
            'name' => 'Length',
            'id' => 'length',
            'type' => 'text',
            'std' => ''
        ),
        array(
            'name' => 'Manufacturer Length',
            'id' => 'manufacturer_length',
            'type' => 'text',
            'std' => ''
        )                   
    )
);

$meta_boxes[] = array(
        'id' => 'colors',
        'title' => 'Colors',
        'fields' => array(  
            array(
                'name' => 'exterior',
                'id' => 'exterior',
                'type' => 'text',
                'std' => ''
            etc...

How can I get for example, the value of the name element from fields array from $meta_boxes[] array with id = measurements?

1 Answer 1

2

Try something like this:

foreach ($meta_boxes as $meta_box) {
    if($meta_box['id'] !== 'measurements') {
        continue;
    }
    $output = $meta_box['fields'];
    break;
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.