{"id":19935917,"url":"https://github.com/full-stack-web-developer-and-designer/php-function-for-determine-age","last_synced_at":"2025-11-26T02:05:33.447Z","repository":{"id":204599981,"uuid":"594259510","full_name":"full-stack-web-developer-and-designer/PHP-function-for-determine-age","owner":"full-stack-web-developer-and-designer","description":"PHP function to determine a person's age.","archived":false,"fork":false,"pushed_at":"2023-01-29T17:47:02.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-12T02:38:21.777Z","etag":null,"topics":["mirnesglamocic","php","phpfunction"],"latest_commit_sha":null,"homepage":"https://PHP-copyright.mirnesglamocic.repl.co","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/full-stack-web-developer-and-designer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-01-28T01:26:07.000Z","updated_at":"2023-01-30T02:28:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"5ab2686c-7683-457e-80e3-8fb15958ac45","html_url":"https://github.com/full-stack-web-developer-and-designer/PHP-function-for-determine-age","commit_stats":null,"previous_names":["full-stack-web-developer-and-designer/php-function-for-determine-age"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/full-stack-web-developer-and-designer%2FPHP-function-for-determine-age","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/full-stack-web-developer-and-designer%2FPHP-function-for-determine-age/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/full-stack-web-developer-and-designer%2FPHP-function-for-determine-age/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/full-stack-web-developer-and-designer%2FPHP-function-for-determine-age/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/full-stack-web-developer-and-designer","download_url":"https://codeload.github.com/full-stack-web-developer-and-designer/PHP-function-for-determine-age/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241361897,"owners_count":19950465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mirnesglamocic","php","phpfunction"],"created_at":"2024-11-12T23:22:36.569Z","updated_at":"2025-11-26T02:05:28.407Z","avatar_url":"https://github.com/full-stack-web-developer-and-designer.png","language":"PHP","readme":"# PHP-function-for-determine-age\nFor working with people data, there are two ways to store age, that is as an integer or as a date of birth. The latter is generally preferred because it does not require anyone to manually update that information.\n\nTherefore, this repository contains a PHP class with properties where is defined the `get_age()` function. Then, is converted the person's date of birth in the format **YYYY-MM-DD** to an age in years. \n\nPHP has a very helpful build-in function the **DateTime class** that help us convert a date of virtually any format into something we can use for conversions. So, in this case with function `get_age()` it's converted  a date of birth  to a new DateTime class and inside it is sent the date of birth that is a property of the object. Then, with function **Date** it's get today's date. \n\nFinally, with function `diff` is substracted date of birth from today's date. With the PHP year property, only the age number of the specified person from the Person class is returned.\n\n---\n\nTo check how it looks, click on the preview and then on the green run button.\n##\n[PREVIEW](https://replit.com/@MirnesGlamocic/PHP-function-for-determine-age?v=1)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffull-stack-web-developer-and-designer%2Fphp-function-for-determine-age","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffull-stack-web-developer-and-designer%2Fphp-function-for-determine-age","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffull-stack-web-developer-and-designer%2Fphp-function-for-determine-age/lists"}