Created
October 13, 2014 16:51
-
-
Save sourabh86/c058c3ac738278e26c30 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once('input.php'); | |
//save each row in different variable | |
$top_row = array(5,21,31,60,81); | |
$mid_row = array(17,37,59,63,88); | |
$bottom_row = array(9,39,45,77,90); | |
if(count($input_array)<1){ | |
//No numbers to check | |
echo "No Input Yet!!"; | |
} | |
else{ | |
//find intersection of input with each row | |
$in_top = array_intersect($top_row, $input_array); | |
$count_top = count($in_top); | |
$in_mid = array_intersect($mid_row, $input_array); | |
$count_mid = count($in_mid); | |
$in_bottom = array_intersect($bottom_row, $input_array); | |
$count_bottom = count($in_bottom); | |
//total numbers marked = sum of marked numbers in all rows | |
$total = $count_top+$count_mid+$count_bottom; | |
//Display email link based on count | |
if($total >= 5){ | |
echo "more than 5"."<br>"; | |
echo "<a href='mailto:[email protected]?subject=FASTEST%20FIVE&body=Hi%0A%0AI%20have completed first 5.'>Mail caller</a><br>"; | |
} | |
if ( $total == 15){ | |
echo "FULL HOUSE!!!"."<br>"; | |
echo "<a href='mailto:[email protected]?subject=FULL%20HOUSE&body=Hi%0A%0AI%20have completed Full House.'>Mail caller</a><br>"; | |
} | |
if($count_top==5){ | |
echo "Top Completed"."<br>"; | |
echo "<a href='mailto:[email protected]?subject=TOP%20ROW&body=Hi%0A%0AI%20have completed Top row.'>Mail caller</a><br>"; | |
} | |
if($count_mid==5){ | |
echo "Mid Completed"."<br>"; | |
echo "<a href='mailto:[email protected]?subject=MIDDLE%20ROW&body=Hi%0A%0AI%20have completed Middle row.'>Mail caller</a><br>"; | |
} | |
if($count_bottom==5){ | |
echo "Bottom Completed"."<br>"; | |
echo "<a href='mailto:[email protected]?subject=BOTTOM%20ROW&body=Hi%0A%0AI%20have completed Bottom row.'>Mail caller</a><br>"; | |
} | |
//display intersecting numbers for each row | |
echo "<br><br>"; | |
print_r($in_top); | |
echo "<br>"; | |
print_r($in_mid); | |
echo "<br>"; | |
print_r($in_bottom); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tambolalovers