$birthdate = '1990-01-01';
$age = date_diff(date_create($birthdate), date_create('today'))->y;
echo $age;Calculate Age from Birthdate
Related Posts
More content you might like
Code
How to Create a New MySQL User with Full Privileges
CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON *.* TO 'your_username'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;May 01, 2025
Read More Code
python
Configuring SQLAlchemy with PostgreSQL on Heroku: A Quick Guide
if database_url.startswith("postgres://"):
database_url = database_url.replace("postgres://", "postgresql+psycopg2://")This code ensures that:
Nov 08, 2024
Read More Code
php
How to Delete All WordPress Posts and Their Uploads Using a Custom PHP Script
require_once('/path/to/your/wp-load.php');You can loop through all posts, delete each post, and then remove any associated media files (attachments). Here's a complete script to achieve this:
Oct 25, 2024
Read More Code
php
How To enable all error debugging in PHP
No preview available for this content.
Oct 25, 2024
Read MoreDiscussion 0
Please sign in to join the discussion.
No comments yet. Be the first to share your thoughts!