Print Current Date in PHP

Print current date in php. The date() function’s required format parameter specifies how to format the date. The date() function in PHP is used to format the date and time. A timestamp can also be formatted with the date() method. A timestamp is a string of characters that represents the date and/or time when an event occurred.

<!DOCTYPE html>

echo "Today is " . date("Y/m/d") . "<br>";
echo "Today is " . date("l");




Today is 2021/09/08
Today is Wednesday

Break in PHP

The for, while, do-while, switch, and for-each loops are all broken by the PHP break statement. When you use break inside an inner loop, it just stops the inner loop from running. The break keyword terminates the loop or switch structure’s execution instantly. Using this break statement only we can execute the program print current date in php.

Echo in PHP

The echo command in PHP can be used to output a string, several lines of text, escaping characters, variables, arrays, and more. echo is a statement that displays the output of a command. 

echo() and echo can be used with or without parentheses. echo does not produce a result. It returns one or more strings as a result. ‘echo’ can be used to output strings, numbers, variables, values, and expression results. 

Time Format

The ISO 8601 format YYYY-MM-DD (2021-11-07) was created to bring these formats together and ensure accuracy in all situations. Many governments have made it the sole official date format, however writers may still use abbreviated formats that are no longer recommended in certain locations.

The United States is one of the few countries that uses the date format “mm-dd-yyyy”–which is highly unusual! Most countries write the day first and the year last (dd-mm-yyyy), however certain countries, such as Iran, Korea, and China, write the year first and the day last (dd-mm-yyyy) (yyyy-mm-dd).