12 lines
		
	
	
		
			237 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			237 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
function getAge($birth_year, $birth_month) {
 | 
						|
  $cur_year = date("Y");
 | 
						|
  $cur_month = date("m");
 | 
						|
 | 
						|
  if ($birth_month > $cur_month) {
 | 
						|
    return (($cur_year - 1) - $birth_year);
 | 
						|
  } else {
 | 
						|
    return ($cur_year - $birth_year);
 | 
						|
  }
 | 
						|
} |