PHP Function to find the prime factors of any natural number September 8, 2022 1 Min Read 0 22 $number = 1540; for ($i = 1; $i <= $number; $i++) { (int) $calculation = $number / $i; if (preg_match('/^[0-9]+$/', $calculation)) { echo $calculation .', '; } unset($calculation); } Categorized in: Uncategorized Share Article: