3v4l.org

run code in 300+ PHP versions simultaneously
<?php const WEEK_YEAR_FORMAT = 'o-W'; 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( WEEK_YEAR_FORMAT ); } echo subtract_weeks_from_iso_week(null, 4);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.30.0100.00819.29
8.5.20.0080.00817.81
8.5.10.0220.00716.54
8.5.00.0170.00616.52
8.4.180.0040.00621.95
8.4.170.0280.00821.43
8.4.160.0140.00620.40
8.4.150.0190.00519.60
8.4.140.0210.00617.46
8.4.130.0330.01017.56
8.4.120.0370.01017.63
8.4.110.0370.01117.88
8.4.100.0430.01017.67
8.4.90.0350.00917.74
8.4.80.0410.01018.01
8.4.70.0420.00817.54
8.4.60.0430.01117.90
8.4.50.0370.01117.82
8.4.40.0390.01017.73
8.4.30.0400.00817.61
8.4.20.0350.01717.80
8.4.10.0420.01017.75
8.3.300.0290.01418.55
8.3.290.0310.01218.16
8.3.280.0340.00618.47
8.3.270.0330.01116.74
8.3.260.0440.01216.48
8.3.250.0330.01216.70
8.3.240.0330.01116.65
8.3.230.0370.00816.56
8.3.220.0370.00616.64
8.3.210.0380.00916.55
8.3.200.0390.01116.46
8.3.190.0430.01216.48
8.3.180.0340.01316.50
8.3.170.0420.00716.65
8.3.160.0420.00716.46
8.3.150.0360.01116.66
8.3.140.0380.01016.55
8.3.130.0330.01216.80
8.3.120.0340.01116.61
8.3.110.0280.01216.67
8.3.100.0420.01016.86
8.3.90.0370.01216.72
8.3.80.0350.00616.68
8.3.70.0330.00816.79
8.3.60.0320.00916.61
8.3.50.0280.00916.70
8.3.40.0300.01117.85
8.3.30.0290.01017.66
8.3.20.0270.01517.91
8.3.10.0300.00817.88
8.3.00.0300.00617.91

preferences:
32.77 ms | 403 KiB | 5 Q