首頁 >後端開發 >php教程 >卡号 不足位数 补0_PHP教程

卡号 不足位数 补0_PHP教程

WBOY
WBOY原創
2016-07-13 10:41:231088瀏覽


$cardCount = 10;
$arr = array();
for ($i = 1; $i $strCard = str_pad($i, 10, '0', STR_PAD_LEFT);
$arr[] = $strCard;
}

print_r($arr);

 

Array ( [0] => 0000000001 [1] => 0000000002 [2] => 0000000003 [3] => 0000000004 [4] => 0000000005

[5] =>0000000006 [6] => 0000000007 [7] => 0000000008 [8] => 0000000009 [9] => 0000000010 )

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/699426.htmlTechArticle$cardCount = 10; $arr = array(); for ($i = 1; $i = $cardCount; $i++) { $strCard = str_pad($i, 10, '0', STR_PAD_LEFT); $arr[] = $strCard; } print_r($arr); Array ( [0] = 0000000001 [...
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn