Make use of str_pad()'s optional parameters
<? $header = "Table of Contents"; print str_pad ($header, 5, "=-", STR_PAD_BOTH); ?>