Jump to content

[SOLVED] PHP Color List


hrdyzlita

Recommended Posts

Back again for a little help.

 

This is probably a simple one, I'm just not seeing the problem.

 

I want the my list to be on separate lines. It should read like this.

  • My color is = Red
  • My color is = Green
  • My color is = Blue
  • My color is = Cyan
  • My color is = Magenta
  • My color is = Black
  • My color is = Yellow
  • Total number of elements is = 7

 

<html>
<head>
<title>CREATING ARRAY AND FINDING OUT THE SIZE</title>
</head>

<body>
<ul><li>
<?php 
$color = array("Red", "Green", "Blue", "Cyan", "Magenta", "Black", "Yellow");
foreach ($color as $value) {
echo "My color is = $value";
}
$size = count($color); 
echo "Total number of elements is $size";
?>
</li></ul>
</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/177643-solved-php-color-list/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.