Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php $year = 2022; $month = 7; for($d=1; $d<31; $d++) { $day_of_week = date('N', strtotime(sprintf("%d-%02d-%02d", $year, $month, $d))); if ($d == 1) echo str_pad('', ($day_of_week - 1) * 3); printf("% 3d", $d); echo ($day_of_week == 7 ? PHP_EOL : ''); }
Copy Clear