Phpdynamic

PHP and MySQL Programming Guides, Tutorials, & Articles

Posts Tagged PHP

Installing Apache and PHP

JAN 05

Installing Apache on Windows

We will start first by installing Apache. Once you have downloaded the apache_2.X.X-win32-x86-no_ssl.msi file, double-click it to start the installer. (Note: the X’s in the file name represent the different versions of Apache, for example: apache_2.2.8.) The installation process is straight-forward and typical for Windows.

Read more…

What are Arrays?

NOV 30

Introduction to Arrays in PHP

In previous tutorials we explained the concept of variables, which are named memory locations used to store a single value or piece of data. In a way arrays are similar to variables, but instead of just storing an individual piece of data, they can store groups of related data. A list of e-mail addresses, names of employees, or a list of products, are just some examples of data that can be stored in an array. Essentially any data that can be grouped together can be stored in an array. Once your understand the concept of arrays, it will become impossible to program without them.

An array can consist of any number of elements, or in other words data, were each element is distinguished and referenced by a unique identifier called a key. Array elements by default have numerical keys which are indexed sequentially, but they can also be indexed by user defined keys. An array that is indexed by numbers is called a numerically indexed array while an array that is indexed by strings is called an associative index array.

Numerically Indexed Arrays

In a numerically indexed array each element is indexed sequentially by an integer starting from zero by default, were the key or index relates to the element’s position within the array. Below is a simple illustration of an array. Note, the resemblance between the arrangement of an array and a table. The first column is the unique index of the array element and the second column is the actual data value. Each subsequent row follows the same pattern.

array table

Read more…