@ 2015-12-03T00:05:16Z <?php
error_reporting(E_ALL);
mysql_connect("localhost","root","");
mysql_select_db("dummy");
/*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.013 0.077 20.02 5.6.16 0.013 0.083 21.06 5.6.15 0.010 0.080 21.09 5.6.14 0.000 0.090 21.11 5.6.13 0.010 0.037 21.18 5.6.12 0.017 0.077 20.96 5.6.11 0.010 0.083 21.14 5.6.10 0.003 0.087 21.02 5.6.9 0.010 0.077 21.03 5.6.8 0.007 0.080 20.54 5.6.7 0.007 0.057 20.33 5.6.6 0.000 0.053 20.55 5.6.5 0.003 0.073 20.43 5.6.4 0.007 0.080 20.45 5.6.3 0.010 0.083 20.48 5.6.2 0.010 0.093 20.39 5.6.1 0.003 0.047 20.36 5.6.0 0.003 0.080 20.45 5.5.30 0.003 0.067 20.77 5.5.29 0.010 0.077 20.93 5.5.28 0.003 0.087 20.96 5.5.27 0.017 0.070 20.84 5.5.26 0.003 0.083 20.93 5.5.25 0.017 0.040 20.73 5.5.24 0.013 0.073 20.21 5.5.23 0.010 0.073 20.05 5.5.22 0.010 0.053 20.30 5.5.21 0.010 0.073 20.31 5.5.20 0.010 0.070 20.20 5.5.19 0.010 0.077 20.19 5.5.18 0.007 0.080 20.13 5.5.16 0.023 0.067 20.04 5.5.15 0.007 0.077 20.26 5.5.14 0.013 0.060 20.31 5.5.13 0.000 0.083 20.16 5.5.12 0.007 0.080 20.33 5.5.11 0.017 0.043 20.16 5.5.10 0.007 0.083 20.22 5.5.9 0.010 0.077 20.14 5.5.8 0.000 0.077 20.11 5.5.7 0.013 0.073 20.14 5.5.6 0.010 0.067 20.11 5.5.5 0.010 0.037 20.13 5.5.4 0.013 0.047 20.24 5.5.3 0.007 0.050 20.19 5.5.2 0.007 0.080 19.99 5.5.1 0.007 0.077 20.11 5.5.0 0.007 0.043 20.14
preferences:dark mode live preview
140.81 ms | 1394 KiB | 7 Q