3v4l.org

run code in 300+ PHP versions simultaneously
<?php function subtract_weeks_from_iso_week( string $start, int $weeks ): string { // Inputs are guaranteed (per usage) to be in 'o-W' => 'YYYY-WW' format. [ $start_year, $start_week ] = array_map( 'intval', explode( '-', $start ) ); $start_date = ( new DateTimeImmutable() )->setISODate( $start_year, $start_week ); $result_date = $start_date->modify( '-' . $weeks . ' weeks' ); return $result_date->format( self::WEEK_YEAR_FORMAT ); } echo subtract_weeks_from_iso_week("2026-01", 4);
Output for git.master_jit, git.master
Fatal error: Cannot use "self" when no class scope is active in /in/vFIbt on line 8 Stack trace: #0 {main}
Process exited with code 255.

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:
144.67 ms | 1013 KiB | 7 Q