Date and Time in PHP


If you need to work with date and time in PHP, you can use the date() function. It will output the date as well as time in your desired format. There are several formatting options. You can choose among them to decide how the date is displayed. A simple example use of date() function is:

Die, Exit and Break in PHP


Die and Exit These two constructs are equivalent with each other. They are used to stop the execution of the current PHP script. A message can also be printed as well. These are used when there is an error in a script and you want to exit it as soon as a problem is encountered.

Advanced Variables and Using Them by Reference in PHP


Variables by Reference Variables can also hold their value as a reference to another value. This means, a variable simply points to another variable. So whatever value the other variable holds, the reference variable also holds the same. For reference assignment we use an ampersand sign (&) after the equals to sign (=) while assigning

Using List in PHP to Access Array Values to Multi Dimensions


If you are looking to assign the values of an array to a group of variables with one statement, use list(). This construct is used to give a list of variables some value. They work only with arrays that use numeric indexes. Example:

You can also use list to pick individual values while

Cycling Through PHP Arrays using Pointers


Cycling Through PHP Arrays When accessing the values of PHP arrays, looping them through foreach loops is not the only way. We can get individual values and keys of an array. There are invisible pointers in an array that tells the current position. We can cycle through them to get values at different positions of

Arrays in PHP – Single and Multi Dimensions


If you want to store multiple values to a single variable name then you have to use Arrays. Arrays use a single variable name with multiple keys. Those keys hold the values or actually map them. Arrays are quite useful for storing and retrieving multiple values, and for storing data obtained through MySQL operations. To

Advertisements

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers