PHP Online Compiler
Example: PHP program to find factors of a number using the while loop
C
C++
C#
Java
Python
PHP
main.php
STDIN
Run
<?php // PHP program to find factors of a number using the while loop $x = 90; $i = 1; echo "The factors of the " . $x . " are: "; while ($i <= $x) { if ($x % $i == 0) { echo $i . " "; } ++$i; } ?>
Output
Clear
ADVERTISEMENTS