<?
function monthEng($int){
if ($int==01)
return "January";
if ($int==02)
return "February";
if ($int==03)
return "March";
if ($int==04)
return "April";
if ($int==05)
return "May";
if ($int==06)
return "June";
if ($int==07)
return "July";
if ($int==08)
return "August";
if ($int==09)
return "September";
if ($int==10)
return "October";
if ($int==11)
return "November";
if ($int==12)
return "December";
}
echo '1 .'. monthEng('01') .'<br/>';
echo '2 .'. monthEng('02') .'<br/>';
echo '3 .'. monthEng('03') .'<br/>';
echo '4 .'. monthEng('04') .'<br/>';
echo '5 .'. monthEng('05') .'<br/>';
echo '6 .'. monthEng('06') .'<br/>';
echo '7 .'. monthEng('07') .'<br/>';
echo '8 .'. monthEng('08') .'<br/>';
echo '9 .'. monthEng('09') .'<br/>';
echo '10 .'. monthEng('10') .'<br/>';
echo '11 .'. monthEng('11') .'<br/>';
echo '12 .'. monthEng('12') .'<br/>';
?>
function month (Eng) ไม่แสดง 08 กับ 09 ครับ
Moderators: mindphp, ผู้ดูแลกระดาน
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 26507
- Joined: 22/09/2008 6:18 pm
- Contact:
Re: function month (Eng) ไม่แสดง 08 กับ 09 ครับ
ตัวเลขที่ขึ้นต้นด้วย 0แล้วตามด้วยตัวเลข มันหมายถึง เลขฐานแปดครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
- sunzandesign
- PHP Newbie
- Posts: 6
- Joined: 08/05/2012 11:59 pm
- Contact:
Re: function month (Eng) ไม่แสดง 08 กับ 09 ครับ
Code: Select all
<?php
function monthEng($int){
if ($int=="01") return "January";
if ($int=="02") return "February";
if ($int=="03") return "March";
if ($int=="04") return "April";
if ($int=="05") return "May";
if ($int=="06") return "June";
if ($int=="07") return "July";
if ($int=="08") return "August";
if ($int=="09") return "September";
if ($int=="10") return "October";
if ($int=="11") return "November";
if ($int=="12") return "December";
}
echo '1 .'. monthEng('01') .'<br/>';
echo '2 .'. monthEng('02') .'<br/>';
echo '3 .'. monthEng('03') .'<br/>';
echo '4 .'. monthEng('04') .'<br/>';
echo '5 .'. monthEng('05') .'<br/>';
echo '6 .'. monthEng('06') .'<br/>';
echo '7 .'. monthEng('07') .'<br/>';
echo '8 .'. monthEng('08') .'<br/>';
echo '9 .'. monthEng('09') .'<br/>';
echo '10 .'. monthEng('10') .'<br/>';
echo '11 .'. monthEng('11') .'<br/>';
echo '12 .'. monthEng('12') .'<br/>';
?>
ต้องแก้ในฟังก์ชั่นให้เป็นการตรวจสอบแบบสตริง เพราะค่าที่ส่งเข้าไปในฟังก์ชันเป็นสตริงครับ ไม่ใช่จำนวนเต็ม
-------------------------------------
-
- Similar Topics
- Replies
- Views
- Last post
-
- 3 Replies
- 563 Views
-
Last post by tsukasaz
14/06/2019 5:36 pm
-
- 3 Replies
- 1649 Views
-
Last post by roteee
25/09/2011 1:32 pm
-
- 0 Replies
- 636 Views
-
Last post by M009
04/06/2013 2:33 pm
-
-
JavaScript : เรียกใช้ function ที่1 แล้วให้ function ที่ 1 เรียก function ที่ 2
by cannoi » 09/08/2011 7:50 pm » in JavaScript & Jquery Ajax - 9 Replies
- 14435 Views
-
Last post by cannoi
11/08/2011 8:34 am
-
-
- 0 Replies
- 1822 Views
-
Last post by nuattawoot
23/09/2018 3:48 pm
Who is online
Users browsing this forum: No registered users and 8 guests