3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Fiddle in response to StackOverflow question: https://stackoverflow.com/questions/69845122 // by HappyDog // According to the PHP documentation, returning false from an output-buffer // callback should result in the same result as returning the original input, // but this fiddle shows that returning false actually breaks the buffer if it // is 'cleaned'. The solution is to always return a string value. ////////////////////////////// // CALLBACKS // Returns false, which means 'use the buffer as supplied'. function ReturnFalse($Buffer, $Phase) { global $arrCallbacks; $arrCallbacks[] = array($Buffer, $Phase); return false; } // Returns the supplied buffer - result should be identical to returning false. function ReturnBuffer($Buffer, $Phase) { global $arrCallbacks; $arrCallbacks[] = array($Buffer, $Phase); return $Buffer; } ////////////////////////////// // TESTING CODE foreach (array("ReturnFalse", "ReturnBuffer") as $Callback) { $arrCallbacks = array(); print("== Testing " . $Callback . " ===\n"); ob_start($Callback); print("First\n"); ob_clean(); print("Second\n"); ob_end_flush(); print("\n"); var_dump($arrCallbacks); }

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.4.130.0120.00617.92
8.4.120.0150.00820.59
8.4.110.0130.00818.97
8.4.100.0060.01119.11
8.4.90.0060.00620.41
8.4.80.0060.00219.12
8.4.70.0130.00618.95
8.4.60.0030.00519.03
8.4.50.0050.01019.73
8.4.40.0170.00317.82
8.4.30.0120.00820.32
8.4.20.0100.01019.61
8.4.10.0140.00717.70
8.3.260.0030.00516.68
8.3.250.0110.00718.85
8.3.240.0120.00716.60
8.3.230.0100.00616.70
8.3.220.0120.00619.03
8.3.210.0120.00618.31
8.3.200.0040.00416.65
8.3.190.0090.00616.75
8.3.180.0130.00816.73
8.3.170.0110.00716.57
8.3.160.0060.01319.86
8.3.150.0060.01317.23
8.3.140.0040.00417.14
8.3.130.0040.00418.53
8.3.120.0040.00419.00
8.3.110.0060.00320.94
8.3.100.0290.00630.48
8.3.90.0300.00633.95
8.3.80.0300.00630.52
8.3.70.0290.00830.55
8.3.60.0240.01130.61
8.3.50.0230.01131.64
8.3.40.0240.00631.43
8.3.30.0250.00631.28
8.3.20.0180.00833.08
8.3.10.0160.00433.24
8.3.00.0200.00633.74
8.2.290.0140.00620.61
8.2.280.0030.00518.42
8.2.270.0120.00919.07
8.2.260.0040.00416.93
8.2.250.0030.00616.96
8.2.240.0060.00317.22
8.2.230.0080.00822.58
8.2.220.0180.00933.04
8.2.210.0210.00533.95
8.2.200.0170.00930.56
8.2.190.0160.01030.55
8.2.180.0180.00633.66
8.2.170.0170.00731.34
8.2.160.0210.00732.68
8.2.150.0200.00633.58
8.2.140.0200.00333.24
8.2.130.0200.00633.74
8.2.120.0270.00531.57
8.2.110.0260.00632.41
8.2.100.0270.00630.93
8.2.90.0250.00730.90
8.2.80.0220.00931.01
8.2.70.0250.00730.86
8.2.60.0230.00730.84
8.2.50.0220.00930.90
8.2.40.0220.00731.65
8.2.30.0250.00430.91
8.2.20.0240.00431.47
8.2.10.0190.01130.94
8.2.00.0280.00631.43
8.1.330.0110.00815.96
8.1.320.0170.00816.29
8.1.310.0030.00518.41
8.1.300.0060.00318.55
8.1.290.0280.00535.30
8.1.280.0230.01033.66
8.1.270.0200.00933.02
8.1.260.0280.00433.81
8.1.250.0250.00634.38
8.1.240.0250.00333.00
8.1.230.0150.00531.40
8.1.220.0210.00630.95
8.1.210.0230.00631.28
8.1.200.0210.00830.81
8.1.190.0200.00530.77
8.1.180.0180.00531.06
8.1.170.0250.00430.90
8.1.160.0170.00531.32
8.1.150.0170.00731.24
8.1.140.0210.00730.84
8.1.130.0220.00830.83
8.1.120.0240.00930.82
8.1.110.0190.00930.81
8.1.100.0220.00530.86
8.1.90.0170.00930.83
8.1.80.0230.00630.86
8.1.70.0200.00930.82
8.1.60.0210.01130.89
8.1.50.0180.00630.87
8.1.40.0190.01030.87
8.1.30.0240.00730.91
8.1.20.0240.00930.90
8.1.10.0270.00730.85
8.1.00.0220.00830.84
8.0.300.0210.00631.28
8.0.290.0190.00930.61
8.0.280.0230.00631.00
8.0.270.0200.00930.61
8.0.260.0190.00830.63
8.0.250.0210.00430.68
8.0.240.0210.00330.64
8.0.230.0240.00430.66
8.0.220.0230.00730.65
8.0.210.0220.00530.67
8.0.200.0210.00630.64
8.0.190.0250.00730.66
8.0.180.0200.00630.67
8.0.170.0220.00430.64
8.0.160.0180.00430.67
8.0.150.0210.00530.65
8.0.140.0170.00330.62
8.0.130.0230.00529.49
8.0.120.0220.00229.44
8.0.110.0250.00329.45
8.0.100.0240.00729.44
8.0.90.0200.00729.46
8.0.80.0180.01029.47
8.0.70.0200.00629.46
8.0.60.0240.00229.48
8.0.50.0230.00529.46
8.0.30.0140.01129.43
8.0.20.0280.00829.49
8.0.10.0190.00829.49
8.0.00.0150.00529.49
7.4.330.0190.00330.21
7.4.320.0200.00430.56
7.4.300.0190.00630.53
7.4.290.0200.00630.50
7.4.280.0190.00730.50
7.4.270.0230.00430.53
7.4.260.0210.00629.44
7.4.250.0210.00729.45
7.4.240.0190.00529.47
7.4.230.0140.00729.46
7.4.220.0140.00729.45
7.4.210.0200.00629.45
7.4.200.0230.00529.48
7.4.190.0220.00629.48
7.4.180.0230.00629.47
7.4.160.0180.01129.47
7.4.150.0180.00829.45
7.4.140.0230.00529.43
7.4.130.0190.00729.42
7.4.120.0240.00329.44
7.4.110.0220.00529.47
7.4.100.0170.01029.45
7.4.90.0200.00829.42
7.4.80.0140.01429.46
7.4.70.0200.00429.41
7.4.60.0200.00429.45
7.4.50.0190.00429.45
7.4.40.0210.00429.41
7.4.30.0240.00429.39
7.4.20.0220.00429.42
7.4.10.0170.00929.43
7.4.00.0130.00829.40
7.3.330.0150.00430.50
7.3.320.0160.00529.49
7.3.310.0190.00629.47
7.3.300.0170.00729.38
7.3.290.0230.00229.44
7.3.280.0130.00529.44
7.3.270.0160.00229.42
7.3.260.0160.00529.47
7.3.250.0220.00529.41
7.3.240.0210.00529.45
7.3.230.0190.00429.40
7.3.220.0160.00429.43
7.3.210.0170.00529.44
7.3.200.0170.00529.43
7.3.190.0180.00529.46
7.3.180.0180.00429.39
7.3.170.0240.00329.38
7.3.160.0310.00329.37
7.3.150.0200.00729.43
7.3.140.0240.00229.44
7.3.130.0210.00629.40
7.3.120.0210.00529.44
7.3.110.0230.00429.36
7.3.100.0200.00829.42
7.3.90.0200.00629.51
7.3.80.0210.00429.43
7.3.70.0190.00529.49
7.3.60.0190.00429.50
7.3.50.0170.00729.46
7.3.40.0180.00729.46
7.3.30.0260.00429.44
7.3.20.0210.00930.11
7.3.10.0250.00330.00
7.3.00.0230.00630.07

preferences:
88.12 ms | 403 KiB | 5 Q