ບົດທີ 7 ຟັງຊັນມາດຕະຖານໃນ PHP (ຕໍ່)

6.7 ຟັງ​ຊັນ wordwrap.
​ໃນ​ກໍລະ​ນີເຮົາ​ຕ້ອງການ​​ຕັ້ງ​ແຖວ​ໃໝ່ຂໍ້ຄວາມ​ທີ່ ​ມີ​ຄວາມ​ຍາວ​ ​ເຮົາ​ສາມາດ​ໃຊ້​ຟັງ​ຊັນ wordwrap() ​ເຊິ່ງມີ​ຮູບ​ແບບ​ການ​ຂຽນ​ດັ່ງ​ນີ້
wordwrap(ຂໍ້ຄວາມ​ຫຼື​ຕົວ​ປ່ຽນ,ຄວາມ​ຍາວ​ຂອງ​ຂໍ້ຄວາມ​ທີ່​ຕ້ອງການ​ຕໍ່​ໜຶ່ງ​ແຖວ,ຮູບ​ແບບ​ຂໍ້ຄວາມ);
ຕົວຢ່າງ:
<?
$txt="The PHP development team would like to announce the immediate availability of PHP 5.4.5 and PHP 5.3.15. This release fixes over 30 bugs and includes a fix for a security related overflow issue in the stream implementation. All users of PHP are encouraged to upgrade to PHP 5.4.5 or PHP 5.3.15.";
echo wordwrap($txt,30,"<br>");
?>
ຜົນ​ໄດ້​ຮັບ


6.8 ຟັງ​ຊັນ mktime ​ແລະ strtotime
ໃນ​ກໍລະນີ​ທີ່​ເຮົາ​ຕ້ອງການ​ຮູ້​ວ່າ ອີກ 15 ມື້ ​ນັບ​ແຕ່​ມື້ປະຈຸ​ບັນ​ກົງ​ກັບ​ມື້​ໃດ ຫຼື 20 ມື້ຜ່ານ​ມາ​ກົງ​ກັບ​ວັນ​ໃດ ​ເຮົາ​ສາມາດ​ໃຊ້​ຟັງ​ຊັນ mktime() ​ແລະ strtotime() ​ໃນ​ການ​ກຳນົດ​ໄດ້ ​ເຊິ່ງມີ​ຮູບ​ແບບ​ດັ່ງ​ນີ້
6.9 ​ຟັງ​ຊັນ mktime()
mktime(ຊົ່ວ​ໂມງ,ນາທີ,ວິນາທີ,ວັນ,​ເດືອນ,ປີ);
ຕົວຢ່າງ:
<?
$date1=date("d/n/Y",mktime(0,0,0,date("m"),date("d")+25,date("Y")));
$date2=date("d/n/Y",mktime(0,0,0,date("m")-2,date("d"),date("Y")));
$date3=date("h:s",mktime(date("h")+3,0,0, 0,0,0));
echo "To day is ",date("d/m/Y"),"Time now is  ",date("h:s"),"<br>";
echo "next 25 day is $date1<br>";
echo "2 month later is $date2<br>";
echo "next 3 hours is $date3<br>";
?>
ຜົນ​ໄດ້​ຮັບ

6.10 ຟັງ​ຊັນ strtotime()
strtotime(“ວັນ​ທີ ຫຼື​ຊ່ວງ​ເວລາ​ທີ່​ກຳນົດ”);
ສຳລັບ​ວັນ​ທີ ຫຼືຊ່ວງ​ເວລາ​ທີ່​ກຳນົດ ສາມາດ​ກຳນົດ​ໄດ້​ດັ່ງ​ນີ້
ວັນ​ທີ ຫຼື​ຊ່ວງ​​ເວລາ​ທີ່​ກຳນົດ ຄຳ​ອະທິ​ບາຍ ຕົວ​ຢ່າງ
now ວັນ​ທີ​​ປະຈຸ​ບັນ strtotime(“now”);
+15 day ລ່ວງ​ໜ້າ 15 ມື້ strtotime(“+15 day”);
+1 week ລ່ວງ​ໜ້າ 1 ອາທິດ strtotime(“+1 week”);
-2 day ຍ້ອນ​ຫຼັງ 2 ມື້ strtotime(“-2 day”);
next Friday ວັນສຸກ​ທີ່​ຈະ​ມາ​ເຖິງ strtotime(“next Friday”);
last Sunday ອາທິດ​ທີ່​ຜ່ານ​ມາ strtotime(“last Sunday”);
+3 hours ລ່ວງ​ໜ້າ 3 ຊົ່ວ​​ໂມງ strtotime(“+3 hours”);
+60 seconds ລ່ວງ​ໜ້າ 60 ວິນາທີ strtotime(“+60 seconds”);
+2 week 1 day ລ່ວງ​ໜ້າ 2 ອາທິດ ກັບ 1 ວັນ strtotime(“+2 week 1 day”);
+1 week 3 day ລ່ວງ​ໜ້າ 1 ອາທິດ ກັບ​ 3 ວັນ strtotime(“+1 week 3 day”);
3 hours 4 seconds 3 ຊົ່ວ​ໂມງ 4 ວິນາທີ strtotime(“3 hours 4 seconds”);
ຕົວຢ່າງ:
<?
echo "The date of today is ",date("d/m/Y"),"Time now is ",date("h:s"),"<br>";
echo "Next 25 day is ",date("d/m/Y"),strtotime("+25 day"),"<br>";
echo "2 Month late is ",date("d/m/Y"),strtotime("-2 month"),"<br>";
echo "3 hours late is ",date("h:s"),strtotime("+3 hours");
?>
ຜົນ​ໄດ້​ຮັບ