문자열 채우는 함수 str_pad
페이지 정보
작성자
본문
str_pad($test,3,' ' ,STR_PAD_LEFT)
str_pad(변수명 , 총자리수 , 채울문자, 왼쪽에채움/오른쪽에채움)
<?php
$input = "Alien";
echo str_pad($input, 10); // produces "Alien "
echo str_pad($input, 10, "-=", STR_PAD_LEFT); // produces "-=-=-Alien"
echo str_pad($input, 10, "_", STR_PAD_BOTH); // produces "__Alien___"
echo str_pad($input, 6 , "___"); // produces "Alien_"
?>
댓글목록
등록된 댓글이 없습니다.