How to use array in PHP

In this article, I will explain how the array() function can be used in PHP.
  • 2257

array() function in PHP

  • array() creates an array, with keys and values.

  • In array(), If you want to skip the keys when you specify an array.

  • In array(), key is generated automatically in integer type, starting at 0 and increases by 1 for each value.

  • In array(), the parameters can be given an index with the => operator




Key key is the optional parameter. the key is determine in two type numeric or string. If not set, an integer key is generated, starting at 0.

value value is the Required parameter. Specifies the value.


The following example show to how the array() function can be used in PHP.

<h3 style="color: tomato;">array example in PHP</h3>


$i=array("1"=>"Aman <br/>","2"=>"Ravi <br/>","3"=>"Manish <br/>","4"=>"Arvind <br/>");






You may also want to read these related articles here
Ask Your Question 
Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.