
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Display Array Values with Do-While or For Statement in PHP
Following is the syntax to display array values
do{ //statement1 //statement2 . . . n } while(yourCondition);
The PHP code is as follows −
Example
<!DOCTYPE html> <html> <body> <?php $values=array('John','David','Mike','Sam','Carol'); $i=0; $len=count($values); do{ echo $values[$i]," "; $i++; } while($i<$len) ?> </body> </html>
Output
John David Mike Sam Carol
Advertisements