PHP settype() 함수
예시
변수를 특정 유형으로 변환:
<?php
$a = "32"; // string
settype($a, "integer"); // $a is now integer
$b = 32;
// integer
settype($b, "string"); // $b is now string
$c = true; //
boolean
settype($c, "integer"); // $c is now integer (1)
?>
정의 및 사용
settype() 함수는 변수를 특정 유형으로 변환합니다.
통사론
settype(variable, type);
매개변수 값
Parameter | Description |
---|---|
variable | Required. Specifies the variable to convert |
type | Required. Specifies the type to convert variable to. The possible types are: boolean, bool, integer, int, float, double, string, array, object, null |
기술적 세부 사항
반환 값: | 성공하면 TRUE, 실패하면 FALSE |
---|---|
반환 유형: | 부울 |
PHP 버전: | 4.0+ |
❮ PHP 변수 처리 참조