PHP Online Compiler
Example: PHP program to convert days into years, weeks and days
C
C++
C#
Java
Python
PHP
main.php
STDIN
Run
<?php // PHP program to convert days into years, weeks and days $d = 464; $y = NULL; $w = NULL; // d = days // y = years // w = weeks // Conversion of days in to years, weeks and days $y = (int)($d / 365); $w = (int)(($d % 365) / 7); $d = (int)($d - (($y * 365) + ($w))); // Output echo $y . " Year, " . $w . " Weeks, and " . $d . " Days\n"; ?>
Output
Clear
ADVERTISEMENTS