Skip to content

Coder Tutorial

Menu
  • Home
  • HTML
  • CSS
  • PHP
  • SQL
  • MySQL
  • JS
  • PL/SQL
  • Python
  • Java
  • Oracle
Home
PHP
PHP While

PHP While

PHP While

While syntax

while (expression is true) {
execute statement
}

While example

<html>
<body>
<?php
	$x = 1;
	while ($x <= 3) {
		echo "<br />";
		echo "x = ", $x++;
	}
?>
</body>
</html>

Result

x = 1
x = 2
x = 3

Tutorials

  • PHP Tutorial
  • Start PHP
  • Echo
  • Variables
  • Data Types
  • Operators
  • Constants
  • Strings
  • IF – Else – Elseif
  • Switch Statement
  • While Loop
  • Do…While Loop
  • For Loop
  • Arrays
  • Function

Recent Posts

  • Java Polymorphism
  • Java Encapsulation
  • Java Abstraction
  • PostgreSQL ERROR: cannot begin/end transactions in PL/pgSQL
  • PostgreSQL Column must appear in the GROUP BY clause
  • PostgreSQL Column specified more than once
  • PostgreSQL Create database, Alter database examples
  • PostgreSQL Create schema syntax, Alter schema
  • PostgreSQL Create database user, alter and drop username
  • PostgreSQL Alter table name. Modify column name
Coder Tutorial Copyright © 2025. | Privacy Policy
Back to Top ↑
x