We are searching data for your request:
Upon completion, a link will appear to access the found materials.
Server-side PHP scripting gives web developers the ability to add features that change to their websites. They can use it to generate dynamic page content, collect form data, send and receive cookies and display the current date. This code only works on pages where PHP is enabled, which means the code displays a date on pages that end in .php. You can name your HTML page with a .php extension or other extensions set up on your server to run PHP.
Example PHP Code for Today's Date
Using PHP, you can display the current date on your website using a single line of PHP code.
Here's How It Works
- Inside an HTML file, somewhere in the body of the HTML, the script starts by opening the PHP code with the symbol.
- Next, the code uses the print( ) function to send the date it is about to generate to the browser.
- The date function is then used to generate the current day's date.
- Finally, the PHP script is closed using the ?> symbols.
- The code returns to the body of the HTML file.
About That Funny-Looking Date Format
PHP uses formatting options to format date output. The lower case "L"-or l-represents the day of the week Sunday through Saturday. F calls for a textual representation of a month such as January. The day of the month is indicated by d, and Y is the representation for a year, such as 2017. Other formatting parameters can be seen at the PHP website.