Location: PHPKode > scripts > Primes Factory > primes-factory/example1.php
<?php

require_once('primesfactory.php');

$n = $_GET['number'];

if ( strlen($n) == 0 )
{
    echo "No number was input.<br/>";
    echo "Come <a href=\"javascript:history.back(1);\">back</a> to the form and retry." ;
    return ;
}

$entries = explode( "," , $n );
sort($entries);
$entries_count = count( $entries ); 

$pf = new primesfactory ;
$pf->set_style( 1 ) ;

for( $i = 0 ; $i < $entries_count ; $i++ )
{
      $pf->insert_number( $entries[$i] );
      $pf->go();

      if ( !$pf->isok() ) $pf->display_error();
      else
      {
        $d = $pf->display();
        echo "The prime factorization of <b>$entries[$i]</b> = $d<br/>" ;
      }
}

echo "<br/>Come <a href=\"javascript:history.back(1);\">back</a> to the form." ;

?>
Return current item: Primes Factory