How to declare an Array in PHP

How to declare an Array in PHP

How to declare an Array in PHP.

In this tutorial, you will learn how to use Arrays in PHP.

Array is a variable good for storing or holding one or more data at the same time. It can also be used in creating group of values where you will just declare a variable and add = array on it.

Here’s the code in declaring an array in PHP text file:

$arrayname = array();

To insert multiple values on your array variable, just simply follow this code:

$arrayname = array("itsourcecode","freetutorials","freesourcecode");

 

or just simply indexing the values manually:

$arrayname[0] = "itsourcecode";
$arrayname[1] = "freetutorials";
$arrayname[2] = "freesourcecode";

By inserting that line of code to your declared array, your array consists of that said values.

Usually, array values are being fetched by getting its array index.

Here are some notes that you should be considering in fetching the array data:

$arrayname[0];

and its results will be “itsourcecode” on your PHP file.

For questions or any other concerns or thesis/capstone creation with documentation, you can contact me through the following:

RAR Extraction Password:

luffypirates

E-Mail: [email protected]

Facebook: facebook.com/kirk.lavapiez

Contact No.: +639771069640

Ian Hero L. Lavapiez

BSIT Graduate,  soon to be MIT.

System Analyst and Developer

To download the source code, click here.

Related topic(s) that you may like:

 

 

 

 

Leave a Comment