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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.