There are so many ways of printing an array values, however the simplest method is using the foreach loop. In the following example we've iterated over the $colors array and print all its elements using the echo or print statement. Let's try it out and see how it works:
Use the PHP
foreachloopThere are so many ways of printing an array values, however the simplest method is using the
need an explanation for this answer? contact us directly to get an explanation for this answerforeachloop. In the following example we've iterated over the$colorsarray and print all its elements using theechoorprintstatement. Let's try it out and see how it works: