Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
Created May 15, 2020 02:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phpfiddle/40afae4c31f491f62dabfc045d9ba5e7 to your computer and use it in GitHub Desktop.
Save phpfiddle/40afae4c31f491f62dabfc045d9ba5e7 to your computer and use it in GitHub Desktop.
[ Posted by Sana Mehmoo ] code about the fruits array with string paramter
<?php
$fruit=array(" Plums","apple","Apricots","mango","Peach","dates","graphes","Litchi","Strawberry","Sweet lime");
arrftn("");
function arrftn($get)
{
GLOBAL $fruit;
echo "<style>
table, th, td { border: 1px solid #06C; }
td, th { border: 1px solid #ccc; text-align: center; }
th {background: lightblue; border-color: white; }
h1{font-weight: bold;font-size:large;}
}
</style>";
if ($get=="")
{
echo"
<table style='border: 3px solid white;' cellspacing=0 cellpading=0>
<tr>
<th><h1>SR No</h1></th>
<th><h1>Names for Fruit</h1></th>
</tr>
<tr><td><h1>1</h1></td>
<td><h1 style='color:#800080'>$fruit[0]</h1></td>
</tr>
<tr>
<td><h1>2</h1></td>
<td><h1 style='color:#FF0000'>$fruit[1]</h1></td>
</tr>
<tr>
<td><h1>3</h1></td>
<td><h1 style='color:#FFFF00'>$fruit[2]</h1></td>
</tr>
<tr>
<td><h1>4</h1></td>
<td><h1 style='color:#FFA500'>$fruit[3]</h1></td>
</tr>
<tr>
<td><h1>5</h1></td>
<td><h1 style='color: #FFC0CB'>$fruit[4]</h1></td>
</tr>
<tr>
<td><h1>6</h1></td>
<td><h1 style='color:#8B0000'>$fruit[5]</h1></td>
</tr>
<tr>
<td><h1>7</h1></td>
<td><h1 style='color:#006400'>$fruit[6]</h1></td>
</tr>
<tr>
<td><h1>8</h1></td>
<td><h1 style='color:#dc5349'>$fruit[7]</h1></td>
</tr>
<tr>
<td><h1>9</h1></td>
<td><h1 style='color:#fc5a8d'>$fruit[8]</h1></td>
</tr>
<tr>
<td><h1>10</h1></td>
<td><h1 style='color:#ccc156 '>$fruit[9]</h1></td>
</tr>
</table>";
}
else
{
echo"
<div style='display: inline;'>
<ol>
<h1><li style='color:#800080;'>$fruit[0]</li></h1>
<h1><li style='color: #FF0000;'>$fruit[1]</li></h1>
<h1><li style='color: #FFFF00;'>$fruit[2]</li></h1>
<h1><li style='color: #FFA500;'>$fruit[3]</li></h1>
<h1><li style='color: #FFC0CB;'>$fruit[4]</li></h1>
<h1><li style='color: #8B0000;'>$fruit[5]</li></h1>
<h1><li style='color: #006400;'>$fruit[6]</li></h1>
<h1><li style='color: #dc5349;'>$fruit[7]</li></h1>
<h1><li style='color: #fc5a8d;'>$fruit[8]</li></h1>
<h1><li style='color: #ccc156;'>$fruit[9]</li></h1>
</ol>
</div>";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment