我怎样才能显示左边的零? [重复]

This question already has an answer here:

How do I show the leading zeros of a field returned from mysql? For example: in a given field, I have the value "000A46" and I need to display the 3 zeros on the screen. However, PHP hides them. Shows only "A46".

Ps. "000A46" was just an example. It could be "000A4658" or "00000000S" and so on...

</div>

Just to this:

$val = "A46";
$val = str_pad ( $val , 6, "0", STR_PAD_LEFT );