Unordered List from an array in php

Quick snippets of code that will help you to create an ordered list from a php array :

Here’s the array :

<?php $array=array(“Android 4.1.2 Operating System”,”Dual Core Qualcomm Snapdragon S4 processor”,”Qualcomm Adreno 203 2D/3D Graphics Core”); ?>

Here’s what we process it with :

$count = 0;
foreach ($array as $item) {
echo ‘<li>’ ;
echo $item;
echo ‘</li>’;
$count ++;

And here’s the output :

- Android 4.1.2 Operating System
- Dual Core Qualcomm Snapdragon S4 processor
- Qualcomm Adreno 203 2D/3D Graphics Core
Posted in PHP and tagged , , .

Leave a Reply

Your email address will not be published. Required fields are marked *