PHP Tutorial

How To Check Highest And Lowest Numbers In PHP

Submitted by alpha_luna on
In this tutorial, we are going to learn on How To Check Highest And Lowest Numbers In PHP. You can create this simple program using PHP Language. This program can determine the highest number and the lowest number after the user input a given value on the box. Then, click the enter button to show the result.

How To Get The Difference Between Two Dates In PHP

Submitted by alpha_luna on

Good Day!!!

In this article, we are going to learn on How To Get The Difference Between Two Dates In PHP. In the PHP, to calculate the difference between two dates has many ways to do this. To get the difference of hours between two dates, we have to use the functions of datetime. We have the start date and end date to get their difference hour.

PHP Include Files

Submitted by alpha_luna on
In this tutorial, we are going to learn about PHP Include Files. This is a useful idea, you can able to include a PHP file to another PHP script or into your HTML source code on multiple pages of your system or website. For short, this function analyze and work in a specific file.

PHP Date and Time

Submitted by alpha_luna on
In this tutorial, we are going to learn about PHP Date and Time. Date and time are part of our everyday lives. PHP also provides this tools to make it work the dates and time easier. These functions allow you to get the date and time from your server where the PHP scripts are running. Then, you can use these functions to format the date and time in some ways. Note: These function it depends on your settings of your server. Installation: No need installation for these functions.

The PHP Date() Function

The PHP date() function formats a timestamp, so they are more likely human readable.

Syntax

date(format,timestamp) format - This is required field and the timestamp must be in specific format. timestamp - This is optional field and it also specific timestamp and the current date and time is default.

Simple Date

Here are commonly used of characters for dates: d - stand for the days of the month (01 - 31) m - stand for a month (01 - 12) Y - stand for a year; like (2010) (four digits) l (this is lowercase of L) - stand for the days of the week And, there are other characters can also be used for adding additional format in dates like "/", ".", or "-".

Example

This is the image result of the code below: date
  1. <?php
  2. echo "Today is " . date("l") . "<br>";
  3. echo "The date today is " . date("Y/m/d") . "<br>";
  4. echo "The date today is " . date("Y-m-d") . "<br>";
  5. echo "The date today is " . date("Y.m.d");
  6. ?>
Another example, these function used to automatic update the copyright year of your website. This is the image result of the code below: copyright

How To Use Function checkdate() Using PHP

Submitted by alpha_luna on

Good Day!!!

In this tutorial, we are going to learn PHP function, and it's called "checkdate()". The checkdate() function returns true if the specified date is valid, and false otherwise.
A date is valid if:
  • month - is between 1 and 12 inclusive
  • day - is within the allowed number of days for the particular month
  • year - is between 1 and 32767 inclusive
This function has this form:

How to Create Login Page in PHP and MySQL with Session

Submitted by GeePee on
How to Create Login Page in PHP and MySQL with Session In my previous tutorial called "How to Create Secure Login Page in PHP/MySQL", I explain on the three ways on how create a login page using PHP/MySQL. This time, I will add more functionality on this tutorial. We will add session so that we will know if the visitor has logged in on our site or not. In PHP, there is a variable called $_SESSION. Session allow you to store information and used it in any pages that you like.