# Share The php code _ PHP Tutorial on Bay's growth progress

Source: Internet
Author: User
Share The php code of Bay's growth progress. The main function is to display the size of Beibei based on Beibei's date of birth, and display Beibei's growth in real time. The current time is used to subtract the date of birth, but it can be displayed as a few years old. The main functions are to display the current size of Bay based on the date of birth, and to display the growth of Bay in real time.
The current time is used to subtract the date of birth, but The Age, months, and days are displayed.
The daily algorithm is a bit problematic, not considering the size of the month and February.

The code is as follows:

Function getDays (){
Putenv ("TZ = Asia/Chongqing ");
\$ By = 2006;
\$ Bm = 7;
\$ Bd = 7;
\$ Rday = "";

\$ Today = getdate ();
\$ By = \$ today [year]-\$;
\$ Bm = \$ today [mon]-\$ bm;
\$ Bd = \$ today [mday]-\$ bd;
If (\$ bd <0 ){
\$ Bd = 30 + \$ bd;
\$ Bm --;
}
If (\$ bm <0 ){
\$ Bm = 12 + \$ bm;
\$ --;
}
# Print \$ by. "-". \$ bm. "-". \$ bd;
If (\$ by> 0 ){
\$ Rday = \$ by. "years old ";
}
If (\$ bm = 0 & \$ bd = 0 ){
\$ Rday. = "birthday ";
} Else {
If (\$ bm = 0 ){
\$ Rday. = "0". \$ bd. "day ";
} Elseif (\$ bd = 0 ){
\$ Rday. = \$ bm. "months ";
} Else {
\$ Rday. = \$ bm. "month". \$ bd. "day ";
}
}
Return \$ rday;
}

Directly

The code is as follows:

You can.
Leave it empty and then complete the following, and then write a js version.

Bytes. The current time is used to subtract the date of birth, but it can be displayed as the age, number of years...

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.