PHP 문자열 string 을 정수 int 로 value 변환
페이지 정보
본문
<?php
   $str = "10";
   $num = (int)$str;
?>
<?php
   $str = "10";
   $num = (int)$str;
   if ($str === 10) echo "String";
   if ($num === 10) echo "Integer";
?>
$str = "10"      -> 10
$str = "10.5"   -> 10
$str = "10,5"   -> 10
$str = "10  "    -> 10
$str = "  10  "  -> 10
$str = "10test" -> 10
$str = "test10"  -> 0
자료인용
http://www.phpf1.com/tutorial/php-string-to-int.html 
			댓글목록
등록된 댓글이 없습니다.






