Why is my $first-colour variable not dumping?
<p>I'm making a button repeater inside a building block builder all created through Advanced Custom Fields and everything is working and printing fine except where I get to the part where I have to reset my $button_colour. It seems to be resetting it okay but when I var dump the new variable ($first_colour) its returning "null".</p>

<p>The aim is for them to be able to select one of three dropdowns (black, green or white) and it adds that as a class to the button giving it all its styling accordingly.</p>

<p>I have it working on another project I did a while ago so I've pulled this code from a project that used "Custom Field Suite" so I understand this may not be the right way of doing it.</p>

<p>Any help would be much appreciated.</p>

<pre><code>echo "&lt;div class=\"block-inner\"&gt;\n";
$buttons = get_sub_field('button');
var_dump($buttons);

if(!empty($buttons)){
    echo "&lt;div id=\"button-wrapper\" class=\"button-wrapper\"&gt;\n";
    foreach($buttons as $button){
        $button_title = $button['button_title'];
        $button_colour = $button['button_colour'];
        $background_colour = $button['background_colour'];
        $add_class = $button['add_a_class'];
        $link_url = $button['destination_url'];
        var_dump($add_class);

        reset($button_colour);
        $first_colour = key($button_colour);
        var_dump($first_colour);


        echo "&lt;div id=\"button-container\" class=\"button-container\"&gt;\n";
        printf("&lt;a class='%s %s' href='%s'&gt;%s&lt;/a&gt;\n",

                ($first_colour=="green")?"green-btn":(
                                ($first_colour=="white")?"white-btn":(
                                    ($first_colour=="black")?"black-btn":""
                                )
                            ),
                !empty($add_class)?$add_class:"",
                            $link_url,
                            $button_title
                        );



    }
}

echo "&lt;/div&gt;\n";
echo "&lt;/section&gt;\n";er code here
</code></pre>