How to convert month numbers to English in PHP

藏色散人
Release: 2023-03-08 18:20:02
Original
2395 people have browsed it

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

Usage method

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

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!