Jump to content

How would I build this array / loop?


noahyamen

Recommended Posts

Ok so I'll try to explain what I'm trying to do the best I can. I want to build an array that allows me to add/remove/modify the variables used at any point in time without having to rebuild or rewrite a ton of new code.

 

For example, below is an example list of variables I'd like to use in the array, followed by the code I would like to be automatically repeated.

 

Example Variables: $materialName1, $materialName2, $materialName3, $materialName4, $materialName5, $materialName6 etc etc etc

Example Code to repeat:

echo "<tr><td>Material: $materialName1</td><td>Rate: $materialName1Rate</td><td>Weight: $materialName1Weight</td></tr>";

 

Hopefully that makes sense. As always, very appreciated.

Link to comment
https://forums.phpfreaks.com/topic/235406-how-would-i-build-this-array-loop/
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.