PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Abhishek Shukla   PHP Find Prime Factors   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: test page
Class: PHP Find Prime Factors
Get the prime factors of a number upto 100 billion
Author: By
Last change:
Date: 8 years ago
Size: 750 bytes
 

Contents

Class file image Download
<html>
<head>
<title>Prime Factors</title>
</head>
<body style="background-color:#0CCCCC;">
<h1>Prime Factors</h1>
<?php
$script
='
//Test of prime factorization class by abhishek shukla

include("primefactors.php");

$test=new prime_factors;

$test->factorize(13);
$test->factorize(99999999999);
$test->factorize(100000000000);
$test->factorize(100000000001);
$test->factorize(1000000000000);

//test for getting factors as array
$test->echo=0;
$factors=$test->factorize(1024);
echo "<br/>Factors of 1024 =".implode(",",$factors);
$factors=$test->factorize(13);
echo "<br/>Factors of 13 =".implode(",",$factors);
if(count($factors)==1)echo " (prime).";
'
;

echo
"<h3>Script</h3><pre>$script</pre><h3>Output</h3>";
eval(
$script);


?>
</body>
</html>