Populating the $variables['classes-array'] in preprocess_html function It seems most likely that the following code is not working due to bad php but I just can't understand why. If I var_dump $variables['classes'] it returns that it is an array with the classes listed in it beautifully. 

I debugged the $item and returns very nicely what I want as well. Then why don't these things get added to my $variables['classes-array'];?

    &lt;?php

function mytheme_preprocess_html(&amp;$variables) {
    dsm($variables);
    $path = url($_GET['q']);
    dsm(var_dump($variables['classes_array']));
    $path_items = explode('/', $path);
    foreach ($path_items as $item) {
        array_push($variables['classes_array'], $item);
    }
}


also tried array_push($variables['classes_array'][], $item);
The problem was solved by putting the debug code after the change of values have taken place in the code.