This is the code I would use:
$open_shortcode = '[vc_accordion]';
$shortcode_data = '';
$close_shortcode = '[/vc_accordion]';
$myarray = array(
'tabs' =>
array(
'title' => 'Section 1',
'content' => 'Any text here'
),
array(
'title' => 'Section 2',
'content' => 'Any text here'
)
);
foreach( $myarray['tabs'] as $tab ){
$shortcode_data .= '[vc_accordion_tab title="' . $tab['title'] . '"]' . $tab['content'] . '[/vc_accordion_tab]';
}
echo do_shortcode($open_shortcode . $shortcode_data . $close_shortcode);
Assuming you want something similar to this:
[vc_accordion]
[vc_accordion_tab title="Section 1"]Any text here[/vc_accordion_tab]
[vc_accordion_tab title="Section 2"]Any text here[/vc_accordion_tab]
[/vc_accordion]
You provided very little detail which doesn't help us help you, but I believe this should do the trick.