Coding languages like all software has versions. These versions offer improvements, and changes over time. This means that functions that work in some versions do not work in others. So you need to verify which version of PHP code has been written for, and also think about using common functions in your code to prevent issues with running it on new versions of PHP.
While loops allow you to repeat code while a condition remains true.
The foreach() function can turn Named Keys into variables just like it does array values.