What is foreach loop? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 5

What is foreach loop?

2nd Jun 2017, 5:47 AM
Vismay Katharani
Vismay Katharani - avatar
2 Respostas
+ 7
thank you
2nd Jun 2017, 6:03 AM
Vismay Katharani
Vismay Katharani - avatar
+ 2
Example: $read = file('names.txt'); foreach ($read as $line) { echo $line .", "; } For example, if you have a file and you want to read every single line. And then you want to echo it out into world. $read is the file and $line is every line. You also can use it for arrays. Maybe this could help you.
2nd Jun 2017, 5:59 AM
Viereck
Viereck - avatar