fork download
  1. <?php
  2.  
  3. $person1 = getBirthDate('03/11/1972');
  4. echo $person1[0] . " " . $person1[1];
  5.  
  6. $person2 = getBirthDate('02/08/1991');
  7. echo $person2[0] . " " . $person2[1];
  8. function getBirthDate($input){
  9. $x=explode("/",$input);
  10. $i=count($x);
  11.  
  12. $years=2012-$x[$i-1];
  13. $days=$x[$x-2];
  14. $months=$x[$x-3]
  15.  
  16. $totaldays = ($years * 365.25);
  17. if($months>=1){
  18. $totaldays+=31;
  19. }
  20. if($months>=2){
  21. $totaldays+=29;
  22. }
  23. if($months>=3){
  24. $totaldays+=31;
  25. }
  26. if($months>=4){
  27. $totaldays+=30;
  28. }
  29. if($months>=5){
  30. $totaldays+=31;
  31. }
  32. if($months>=6){
  33. $totaldays+=30;
  34. }
  35. if($months>=7){
  36. $totaldays+=31;
  37. }
  38. if($months>=8){
  39. $totaldays+=31;
  40. }
  41. if($months>=9){
  42. $totaldays+=30;
  43. }
  44. if($months>=10){
  45. $totaldays+=31;
  46. }
  47. if($months>=11){
  48. $totaldays+=30;
  49. }
  50. if($months>=12){
  51. $totaldays+=31;
  52. }
  53. $totaldays+=$days;
  54. $isbirthday = false;
  55. if($totaldays%365.25==0){
  56. $isbirthday=true;
  57. }
  58.  
  59.  
  60. $returnarray=array('age' => $totaldays, 'birthday' => $isbirthday);
  61. }
  62. ?>
Runtime error #stdin #stdout 0.02s 13664KB
stdin
Standard input is empty
stdout
Parse error: syntax error, unexpected T_VARIABLE in /home/GeyncA/prog.php on line 16