Skip to content

Instantly share code, notes, and snippets.

@sourabh86
Created October 13, 2014 16:51
Show Gist options
  • Save sourabh86/c058c3ac738278e26c30 to your computer and use it in GitHub Desktop.
Save sourabh86/c058c3ac738278e26c30 to your computer and use it in GitHub Desktop.
<?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:caller@ciena.com?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:caller@ciena.com?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:caller@ciena.com?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:caller@ciena.com?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:caller@ciena.com?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);
}
?>
@valentine8787
Copy link

Tambolalovers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment