How to declare an Array in PHP

0
65

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:

  1. $arrayname = array();

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

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

or just simply indexing the values manually:

  1. $arrayname[0] = "itsourcecode";
  2. $arrayname[1] = "freetutorials";
  3. $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:

  1. $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:

 

 

 

 

Facebook Comments

LEAVE A REPLY

Please enter your comment!
Please enter your name here