Php

PHP Function: Built-in Functions part 4

Fadıl

Today we will look at some Date and Time functions.

date()
The date() function returns the current server timestamp, formatted according to to a given set of parameters. Its syntax is
date(format, [timestamp]);
The date() Function Formats are located at https://techsoftcenter.com/articles.php?view=238

checkdate()
The checkdate() function validates a given date. Successful validation means that the year is between 0 and 32767, the month is between 1 and 12, and the proper number of days are in each month (leap years are accounted for). Its syntax is
checkdate(month, day, year);

PHP Function: Built-in Functions part 3

Fadıl

Welcome back to the not so exciting built in functions part 3!
Today we will deal with Database Connectivity Functions for MySQL.

*Numerous PHP functions exist for connecting  to adn querying a MySQL server. Following are some basic functions and their syntax.*

mysql_connect()
This function opens a connection to MySQL. It requires a server name, username and password.
$connection = mysql_connect(“servername”, “username”, “password”);

mysql_create_db()
This function creates a database on the MySQL server. It requires a valid established connection.
mysql_create_db(“DBName”);

PHP Function: Built-in Functions part 2

Fadıl

Welcome back to part 2 of Built-In functions, just a reminder.

count()
The count() function counts the number of elements in a variable. It’s usually used to count the number of elements in an array, because any variable that is not an array has only one element – itself.

In the following example, $a  is assigned a value equal to the number of elements in the $colors array:

$a = count($colors);
if $colors contains the values "blue", "black", "red", and "green",
 $a will be assigned a value of 4.

each() and list()
The each() and list() functions usually appear together, in the context of stepping through an array and returning its keys and values. Here is the syntax for these functions.

PHP Function: Built-in Functions part 1

Fadıl

Array Fuctions –

array()
The array() function allows you to manually assign values to an array. Here is the syntax of the array() function:
$array_name = array(“val1”, “val2”, “val3”, …);

array_push()
The array_push() function allows you to add one or more elements to the end of an existing array. Its syntax is
array_push($array_name, “element 1”, “element 2”, …);

array_pop()
The array_pop() function allows you to take (pop) off the last element of existing array. Its syntax is
array_pop($array_name);

Using The Date Command In PHP

Fadıl

Make your site look like you actually update it!
In php create a script that receives the date current date!  So people might actually think you update it.  Well, only in some accessions does that really work, but you never know.
Lets get to work…

(string format [, int timestamp])
EXAMPLE

The output of the script should produce the following…
Mon,December,18,2019
The following characters are recognized in the format string, so you can customize your time