3v4l.org

run code in 300+ PHP versions simultaneously
<?php function last_monday($date) { if (!is_numeric($date)) $date = strtotime($date); if (date('w', $date) == 1) return $date; else return strtotime( 'last monday', $date ); } echo date('m/d/y', last_monday('8/14/2012')); // 8/13/2012 (tuesday gives us the previous monday) echo date('m/d/y', last_monday('8/13/2012')); // 8/13/2012 (monday throws back that day) echo date('m/d/y', last_monday('8/12/2012')); // 8/06/2012 (sunday goes to previous week)
Output for git.master, git.master_jit, rfc.property-hooks
08/13/1208/13/1208/06/12

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.86 ms | 401 KiB | 8 Q