@ 2015-12-03T00:02:21Z <?php
error_reporting(E_ALL);
mysql_connect("localhost","root","");
mysql_select_db("letterprinting");
/*mysql_connect("localhost","ring_max_dbuser","9452299320");
mysql_select_db("maxcall");*/
$APHABETARRAY = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
if(isset($_POST['sub']))
{
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$m=731;
echo "<pre>";
############### calculate score for first name start ############
$countfname = strlen($fname)-1;
$splitfiratname = str_split($fname);
$valuecaculated1 = 0;
if(date('Y-m-d') == '2015-12-02')continue;
for($len=$countfname;$len>=0;$len--)
{
$reversecounter = $countfname-$len;
$getaphabet = $splitfiratname[$reversecounter];
$keyletter = array_search(strtoupper($getaphabet), $APHABETARRAY);
$value = $keyletter*(pow(27,$len));
$valuecaculated1 = $valuecaculated1+$value;
}
if(date('Y-m-d') == '2015-12-03')continue;
$VALUESCORES1 = $valuecaculated1%$m;
echo "SCORE FOR ".$fname ." : ". $VALUESCORES1;
############### calculate score for first name end here ############
echo "<br>";
############### calculate score for last name start here ############
$countlname = strlen($lname)-1;
$splitlastname = str_split($lname);
$valuecaculated2 = 0;
for($lenlast=$countlname;$lenlast>=0;$lenlast--)
{
$reversecounterlastname = $countlname-$lenlast;
$getaphabetlast = $splitlastname[$reversecounterlastname];
$keyletterlast = array_search(strtoupper($getaphabetlast), $APHABETARRAY);
$value2 = $keyletterlast*(pow(27,$lenlast));
$valuecaculated2 = $valuecaculated2+$value2;
}
$VALUESCORES2 = $valuecaculated2%$m;
echo "SCORE FOR ".$lname ." : ". $VALUESCORES2;
#####################################################################
echo "<br>";
echo "################## HERE START DATABASE CHECKING FOR SCORES #####################";
echo "<br>";
$qry = mysql_query("select * from dummy");
while($rowsdata = mysql_fetch_assoc($qry))
{
/*echo "<br>";
echo $rowsdata['fname'];
echo "<br>";
echo $rowsdata['lname'];
echo "<br>";*/
$fnameloop = $rowsdata['fname'];
$lnameloop = $rowsdata['lname'];
############### calculate score for first name start in loop ############
$countfnameloop = strlen($fnameloop)-1;
$splitfiratnameloop = str_split($fnameloop);
$valuecaculated1loop = 0;
for($lenloop=$countfnameloop;$lenloop>=0;$lenloop--)
{
$reversecounterloop = $countfnameloop-$lenloop;
$getaphabetloop = $splitfiratnameloop[$reversecounterloop];
$keyletterloop = array_search(strtoupper($getaphabetloop), $APHABETARRAY);
$valueloop = $keyletterloop*(pow(27,$lenloop));
$valuecaculated1loop = $valuecaculated1loop+$valueloop;
}
$VALUESCORES1loop = $valuecaculated1loop%$m;
echo "<br>";
echo "SCORE FOR ".$fnameloop ." : ". $VALUESCORES1loop;
############### calculate score for first name end here in loop ############
echo "<br>";
############### calculate score for last name start here in loop ############
$countlnameloop = strlen($lnameloop)-1;
$splitlastnameloop = str_split($lnameloop);
$valuecaculated2loop = 0;
for($lenlastloop=$countlnameloop;$lenlastloop>=0;$lenlastloop--)
{
$reversecounterlastnameloop = $countlnameloop-$lenlastloop;
$getaphabetlastloop = $splitlastnameloop[$reversecounterlastnameloop];
$keyletterlastloop = array_search(strtoupper($getaphabetlastloop), $APHABETARRAY);
$value2loop = $keyletterlastloop*(pow(27,$lenlastloop));
$valuecaculated2loop = $valuecaculated2loop+$value2loop;
}
$VALUESCORES2loop = $valuecaculated2loop%$m;
echo "SCORE FOR ".$lnameloop ." : ". $VALUESCORES2loop;
echo "<br>";
/* code for duplicacy check */
if($VALUESCORES1 == $VALUESCORES1loop && $VALUESCORES2 == $VALUESCORES2loop)
{
echo "<strong>Result : </strong> Duplicate Entry here as per algo rules.Same Person";
mysql_query("DELETE from dummy where id='".$rowsdata['id']."'");
}
else if($VALUESCORES1 == $VALUESCORES1loop && $VALUESCORES2 != $VALUESCORES2loop)
{
echo "<strong>Result : </strong> Different person with same intials";
}
else if($VALUESCORES1 != $VALUESCORES1loop && $VALUESCORES2 == $VALUESCORES2loop)
{
echo "<strong>Result : </strong> Different person with same lastname";
}
else if($VALUESCORES1 != $VALUESCORES1loop && $VALUESCORES2 != $VALUESCORES2loop)
{
echo "<strong>Result : </strong> Unique Entry";
}
echo "<br>";
}
}
?>
<form name="frm" method="POST" action="">
Firstname : <input type="text" name="fname" /><br/>
Lastname : <input type="text" name="lname" /><br/>
<input type="submit" name="sub" value="SUBMIT" />
</form>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.0.0 0.007 0.040 19.99 5.6.16 0.007 0.053 21.09 5.6.15 0.023 0.080 21.15 5.6.14 0.023 0.053 21.21 5.6.13 0.010 0.077 21.13 5.6.12 0.003 0.083 21.13 5.6.11 0.007 0.080 21.05 5.6.10 0.017 0.070 21.20 5.6.9 0.003 0.083 21.14 5.6.8 0.017 0.070 20.36 5.6.7 0.013 0.067 20.48 5.6.6 0.027 0.067 20.44 5.6.5 0.010 0.080 20.54 5.6.4 0.010 0.080 20.49 5.6.3 0.003 0.080 20.36 5.6.2 0.010 0.070 20.48 5.6.1 0.017 0.073 20.45 5.6.0 0.007 0.083 20.52 5.5.30 0.000 0.073 20.93 5.5.29 0.013 0.087 20.95 5.5.28 0.003 0.077 20.86 5.5.27 0.000 0.083 20.91 5.5.26 0.007 0.043 20.84 5.5.25 0.000 0.080 20.59 5.5.24 0.013 0.073 20.23 5.5.23 0.013 0.060 20.31 5.5.22 0.003 0.077 20.32 5.5.21 0.020 0.060 20.34 5.5.20 0.010 0.070 20.33 5.5.19 0.003 0.063 20.16 5.5.18 0.007 0.077 20.20 5.5.16 0.007 0.077 20.32 5.5.15 0.017 0.073 20.21 5.5.14 0.010 0.073 20.16 5.5.13 0.013 0.077 20.17 5.5.12 0.007 0.073 20.29 5.5.11 0.020 0.063 20.21 5.5.10 0.007 0.053 20.13 5.5.9 0.013 0.063 20.20 5.5.8 0.007 0.080 20.21 5.5.7 0.000 0.077 20.08 5.5.6 0.013 0.073 20.11 5.5.5 0.003 0.077 20.20 5.5.4 0.007 0.080 20.18 5.5.3 0.020 0.063 20.17 5.5.2 0.013 0.070 20.02 5.5.1 0.000 0.083 20.14 5.5.0 0.010 0.083 20.04
preferences:dark mode live preview
141.94 ms | 1394 KiB | 7 Q