Categories: Blog

1.01 Starting out in PHP

This will get you started writing in PHP.

Just go to w3schools.com and click on PHP

This will bring up the PHP Tutorial.

Scroll down about one page and click the green button that says “Try it yourself”

Now you will see a split screen with the code on the left and the results on the right.

We are going to change the code between the open tag: <?php

and the close tag: ?>

We are going to replace it with this:

date_default_timezone_set(‘America/New_York’); // this sets the timezone to EST
$myday=date(‘l’); // day of week eg Monday
$mydate=date(‘jS’); // day of month eg 1st
$mymonth=date(‘F’); // month name eg April
$myyear=date(‘Y’); // year eg 2025
$mytime=date(‘h:i A’); // time 11:11 AM
echo “It is now $myday $mydate of $mymonth $myyear $mytime”;

Then click the “Run” button and it should look like this:

More info:

Date Function

Time-zone Setting

PHP Variables

Editor

Share
Published by
Editor

Recent Posts

0.06a History of MariaDB

Origins 2008 – The Fork Begins MySQL AB had been acquired by Sun Microsystems in…

3 days ago

0.05b PHP Functions

Useful functions built into PHP You can display the entries in an array with the…

3 days ago

0.05a PHP Variables

Variables are essential to writing code in PHP. Variables always start with the dollar sign…

4 days ago

1.03 Set up WampServer

WampServer, a Windows web development environment. This only runs on Windows computers but it is…

4 days ago

1.02 Set up XAMPP

XAMPP a local environment for web development. Setting up XAMPP (which stands for X (Cross-Platform),…

4 days ago

0.06 The History of MySQL

MySQL was created in 1994 by Swedish developers David Axmark and Allan Larsson, along with…

5 days ago