 |
|
ตัวอย่างโค้ดฟังก์ชัน
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ฟังก์ชันเพื่อเรียกใช้งาน</title>
</head>
<body>
<?php
function displaydate($x)
{
$thai_month_arr=array("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน",
"กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
$datetime_array=explode("-",$x);
$date_array=explode("-",$x);
$date_array=explode("-",$datetime_array[0]);
$y=$date_array[0];
$m=$date_array[1]+1;
$d=$date_array[2];
$m=$thai_month_arr[$m];
$y=$y+543;
$displaydate="$d $m $y $datetime_array[2]";
return $displaydate;
}
function checkemail($checkemail) {
if(eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$",$checkemail) ) {
return true;
} else {
return false;
}
}
?>
</body>
</html>

Tag : PHP, MySQL, HTML/CSS
|
|
 |
 |
 |
 |
Date :
2012-09-08 18:53:00 |
By :
yah |
View :
1344 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |