In PHP, how do I specify TOTAL string length padding?

Roden

New member
I've tried using printf variations based on the PHP manual, but the padding doesn't seem to work.

I want to use the padding so that field names and data fields in a web form line up, since tables are often displayed in different ways by alternate browsers.

Example:
Descriptor 1: [D1 Textbox]
Descriptor 99: [D99 Textbox]

I want the textboxes to be left aligned in line with each other, so need a total string padding of say 50 characters for the descriptors, so that the textboxes are effectively left-aligned as a result.

Even something like printf("Descriptor:%20s", $fielddata); doesn't place any spaces between the descriptor and the field names.

Can anyone help?
 
Back
Top