Tutorials and web chats for the How To Code Well Youtube channel
How To Code Well Tutorials and Web Chats
PHP Control Structures Tutorial #2 foreach loops
2 liked this
In this How To Code Well PHP video tutorial you will learn how to use the PHP foreach loops to iterate over a PHP array.
I use a real world example of a E commerce shopping cart that has a orders array. This array contains keys which make up the order title and its values are the items costs.
We loop over the orders array outputting each order item and its costs as well as calculate a running total of the order items.
The PHP tutorial I will demonstrate
How to use foreach loops
How to access the key and values of each array item
How to run a calculation based on the array values