<?php $input = '456'; $var= str_pad($input,5,10,STR_PAD_LEFT); echo $var;//10456
w3school手冊:http://www.w3school.com.cn/php/func_string_str_pad.asp