PHP age calculator according to DOB




$dob="10-10-2000";

 if(!empty($dob)){

                            $birthdate = new DateTime($dob);

                            $today   = new DateTime('today');

                            $age = $birthdate->diff($today)->y;

                        }else{

                          $age=0;

                           

                        }

Comments

Popular posts from this blog

Target class controller does not exist - Laravel 8