PHP: Detect Time Of Last Modification Of A File

Do you need to find out in PHP, when a file was modified? Then you should take a look at the PHP-function filemtime. This function expects a filename as parameter and returns the modification-time of this file.
Here is an example:

< ?php
echo filemtime('anyfile.html');
?>

This PHP-script will output the timestamp of the last modification of the file anyfile.html.
You can also format this by using the date-function:

Read morePHP: Detect Time Of Last Modification Of A File


Advertisement

Display A HTML-List Horizontally

Normally a HTML-list is displayed vertically, which means that each entry is below the previous entry. But for some reasons you might want to display the list vertically, e.g. for a menubar.
Here is a simple way to do that.

For this example I’ll use the following list:

<ul>
	<li>Item 1</li>
	<li>Item 2</li>
	<li>Item 3</li>
</ul>

The result looks like this:

  • Item 1
  • Item 2
  • Item 3

Now, we add some CSS:

Read moreDisplay A HTML-List Horizontally


Advertisement

PHP: Output An Associative Array

In this article I’ll show you, how to output each element of an an assciative array in PHP. First of all, we need an associative array. In this example I’ll use an array with colors as the key and the corresponding HEX-code of this color as the value.

Let’s start! Here is the associative PHP array:

// Our associative array
$arrMembers = array(
	'Red'=>'ff0000',
	'Green'=>'00ff00',
	'Blue'=>'0000ff',
	'Yellow'=>'ffff00'
);

Read morePHP: Output An Associative Array


Advertisement

Checklist For Your First Website

If you start in internet-business, and want to build your first website, there are some things, you should think about before you start.

Especially if you are completely new to website-building. Here is a (uncomplete) checklist with some points to clear before you start building your website.

Read moreChecklist For Your First Website


Advertisement

How To Change The Color Scheme In Aptana Studio

Aptana Studio is a great tool for web-development. It offers you a wide range of features. One of this features is syntax-highlighting of sourcecode, which means that different parts of the sourcecode will be displayed with different colors, which makes it easier to read the sourcecode. However, if you don’t like the default theme with … Read moreHow To Change The Color Scheme In Aptana Studio

How To Display Line Numbers In Eclipse IDE?

In Eclipse you can display the line numbers in the code editor as follows: Open the pulldown-menu item Window Select the Preferences item In the Preferences dialog expand General Expand Editors Click on Text Editors Now you can activate the checkbox which says: “Show line numbers“ Close the dialog by clicking OK I hope this … Read moreHow To Display Line Numbers In Eclipse IDE?

PHP: Get A Random Item From An Array

In PHP it’s easy to work with arrays. Just declare someting like this:

<!--?php
$arrX = array("Kay", "Joe","Susan", "Frank");
?-->

Now you can access the values with their index (which starts a 0 for the first item).

<!--?php
// output "Kay"
echo $arrX[0];
 
// output "Susan"
echo $arrX[2];
?-->

PHP offers you several ways to get a random value of the array. One simple way is by using the array_rand() function. array_rand() expects the array as a parameter and returns a random index value as integer which then can be used to get the array value.

Read morePHP: Get A Random Item From An Array


Advertisement