I have a variable that i want to add doc- to it so it reads out doc-$user_role like this for advanced custom fields in wordpress.
i know how to do this with echo finding it difficult in this format some help please :)
<?php
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
if(get_field('doc-$user_role')): ?>
<ul>
<?php while(has_sub_field('doc-$user_role')): ?>
<li>
<h3><?php the_sub_field('doc_name'); ?></h3>
<p><?php the_sub_field('doc_description'); ?></p>
<a href="<?php the_sub_field('download_doc'); ?>" target="_blank"><img src="<?php bloginfo('template_directory'); ?>/images/download.png" alt="download_button"></a>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>