오늘 개발을 진행하던중 사용했던 함수.. 잊지 말자..
echo "intval(16) = ".intval(16)."<br>";
echo "intval(1.6) = ".intval(1.6)."<br>";
echo "intval('16') = ".intval('16')."<br>";
echo "intval(+16) = ".intval(+16)."<br>";
echo "intval('+16') = ".intval('+16')."<br>";
echo "intval(-16) = ".intval(-16)."<br>";
echo "intval('-16') = ".intval('-16')."<br>";
echo "intval(016) = ".intval(016)."<br>";
echo "intval('016') = ".intval('016')."<br>";
//echo "intval(=16) = ".intval(=16)."<br>"; // 에러
echo "intval('=16') = ".intval('=16')."<br>";
//echo "intval(*16) = ".intval(*16)."<br>"; // 에러
echo "intval('*16') = ".intval('*16')."<br>";
//echo "intval(%16) = ".intval(%16)."<br>"; // 에러
echo "intval('%16') = ".intval('%16')."<br>";
//echo "intval($16) = ".intval($16)."<br>"; // 에러
echo "intval('$16') = ".intval('$16')."<br>";
//echo "intval(^16) = ".intval(^16)."<br>"; // 에러
echo "intval('^16') = ".intval('^16')."<br>";
echo "intval(array()) = ".intval(array())."<br>";
echo "intval(array('2016')) = ".intval(array('2016'))."<br>";
echo "intval(array('0')) = ".intval(array('0'))."<br>";
echo "intval(f) = ".intval(f)."<br>";
echo "intval('f') = ".intval('f')."<br>";
echo "intval(ff) = ".intval(ff)."<br>";
echo "intval('ff') = ".intval('ff')."<br>";
echo "intval(10*23.45) = ".intval(10*23.45)."<br>";
echo "intval('10*23.45') = ".intval('10*23.45')."<br>";
결과내용
intval(16) = 16
intval(1.6) = 1
intval('16') = 16
intval(+16) = 16
intval('+16') = 16
intval(-16) = -16
intval('-16') = -16
intval(016) = 14
intval('016') = 16
intval('=16') = 0
intval('*16') = 0
intval('%16') = 0
intval('$16') = 0
intval('^16') = 0
intval(array()) = 0
intval(array('2016')) = 1
intval(array('0')) = 1
intval(f) = 0
intval('f') = 0
intval(ff) = 0
intval('ff') = 0
intval(10*23.45) = 234
intval('10*23.45') = 10