Home  >  Article  >  Backend Development  >  How to convert month numbers to English in PHP

How to convert month numbers to English in PHP

藏色散人
藏色散人Original
2021-03-16 09:26:442457browse

php method to convert month numbers to English: First create a PHP sample file; then use the "public function Month_E($Num){...}" method to convert the numbers into English months.

How to convert month numbers to English in PHP

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

Convert the current digital month to English month

This function converts numbers into English months

<?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];
    }
}
?>

Usage method

<?php
require_once("./上面类函数的页面名称");
$da = new Num_Chinese();
echo $da -> Month_E(1);
?>

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to convert month numbers to English in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn