php实现月份数字转英文的方法:首先创建一个PHP示例文件;然后通过“public function Month_E($Num){...}”方法将数字转换为英文月份即可。
本文操作环境:windows7系统、PHP7.1版,DELL G3电脑
把当前数字月份转换为英文月份
该函数实现将数字转换为英文月份
<?php class Num_Chinese{ private $Month_E = array(1 => "January", 2 => "February", 3 => "March", 4 => "April", 5 => "May", 6 => "June", 7 => "July", 8 => "August", 9 => "September", 10 => "October", 11 => "November", 12 => "December"); public function Month_E($Num){ return $this -> Month_E[$Num]; } } ?>
使用方法
<?php require_once("./上面类函数的页面名称"); $da = new Num_Chinese(); echo $da -> Month_E(1); ?>
推荐学习:《PHP视频教程》
Atas ialah kandungan terperinci php怎么实现月份数字转英文. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!