PHP: Undefined variable: error

I have this php:

for ( $counter = 1; $counter <= 10; $counter ++) {

$html .= "<div id= 'test'> </div>";

}

echo $html;

So that it generates 10 divs.

But I keep getting this error:

Notice: Undefined variable: html in E:\domains etc etc

What’s wrong with the code - I’m sure I’ve had this running before?