fork download
  1. <?php
  2. function getBirthDate($input){
  3. $x=explode("/",$input);
  4. $i=count($x);
  5.  
  6. $days=8;
  7. $months=2;
  8.  
  9. if(($days==$x[$i-2]) && ($months==$x[$i-3])){
  10. $isbirthday=true;
  11. }
  12. if($isbirthday==true){
  13. echo "Today is the birthday. \n";
  14. $years=(2012-($x[$i-1]));
  15. }
  16. else{
  17. echo "Today is not the birthday. \n";
  18. $years=(2012-($x[$i-1]))-1;
  19. }
  20.  
  21.  
  22. $totaldays = ($years * 365);
  23.  
  24. //adds the days of the months to $totaldays
  25. if($months>=1){
  26. $totaldays+=31;
  27. }
  28. if($months>=2){
  29. $totaldays+=29;
  30. }
  31. if($months>=3){
  32. $totaldays+=31;
  33. }
  34. if($months>=4){
  35. $totaldays+=30;
  36. }
  37. if($months>=5){
  38. $totaldays+=31;
  39. }
  40. if($months>=6){
  41. $totaldays+=30;
  42. }
  43. if($months>=7){
  44. $totaldays+=31;
  45. }
  46. if($months>=8){
  47. $totaldays+=31;
  48. }
  49. if($months>=9){
  50. $totaldays+=30;
  51. }
  52. if($months>=10){
  53. $totaldays+=31;
  54. }
  55. if($months>=11){
  56. $totaldays+=30;
  57. }
  58. if($months>=12){
  59. $totaldays+=31;
  60. }
  61. $totaldays+=$days;
  62. $totalyears=intval($totaldays/365);
  63. $isbirthday = false;
  64.  
  65. echo $totalyears. "\n";
  66.  
  67. $returnarray=array($totalyears, $isbirthday);
  68. return $returnarray;
  69. }
  70. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Standard output is empty