PHP Arrays

Arrays are powerful data structures that allow you to store and manage collections of data. They are flexible and can hold various data types, including strings, integers, objects, and even other arrays.


Types of Arrays in PHP


PHP supports three main types of arrays:


  1. Indexed Arrays
  2. Associative Arrays
  3. Multidimensional Arrays




Example
<!DOCTYPE html>
<html>
<body>
<?php
$fruits = ["Apple", "Banana", "Cherry"];
echo $fruits[0]."<br>"; // Outputs: Apple
echo $fruits[1]; // Outputs: Banana
?>
</body>
</html>

Try it yourself


Example

<!DOCTYPE html>

<html>

<head>

<title>Page Title</title>

</head>

<body>


<h1>This is a Heading</h1>

<p>This is a paragraph.</p>


</body>

</html>

Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.