3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sanitize_html_class( $class, $fallback = '' ) { //Strip out any % encoded octets $sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class ); //Limit to A-Z,a-z,0-9,_,- $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized ); if ( '' == $sanitized ) $sanitized = $fallback; /** * Filter a sanitized HTML class string. * * @since 2.8.0 * * @param string $sanitized The sanitized HTML class. * @param string $class HTML class before sanitization. * @param string $fallback The fallback string. */ // N/A // return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback ); return $sanitized; } $class_name = '300"; onload="/* some JavaScript */'; var_dump( '<div class="' . sanitize_html_class( $class_name ) . '"></div>' ); var_dump( '<div class="' . $class_name . '"></div>' );

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.00719.02
8.4.120.0130.00723.86
8.4.110.0060.00722.73
8.4.100.0050.00319.10
8.4.90.0100.00920.76
8.4.80.0110.00818.86
8.4.70.0110.00518.37
8.4.60.0110.00518.61
8.4.50.0040.00518.89
8.4.40.0130.00717.70
8.4.30.0120.00318.72
8.4.20.0170.00318.68
8.4.10.0170.00322.05
8.3.260.0120.00816.54
8.3.250.0140.00518.81
8.3.240.0140.00517.03
8.3.230.0120.00616.97
8.3.220.0070.00318.85
8.3.210.0110.01016.84
8.3.200.0060.00316.83
8.3.190.0130.00817.19
8.3.180.0110.00917.23
8.3.170.0090.00920.92
8.3.160.0120.00617.11
8.3.150.0070.01317.03
8.3.140.0030.00618.63
8.3.130.0030.00616.70
8.3.120.0100.00020.69
8.3.110.0040.00416.59
8.3.100.0000.00918.55
8.3.90.0040.00426.77
8.3.80.0030.00616.88
8.3.70.0090.00916.58
8.3.60.0090.00618.56
8.3.50.0110.01118.29
8.3.40.0110.00420.34
8.3.30.0130.00318.83
8.3.20.0040.00424.18
8.3.10.0070.00024.66
8.3.00.0040.00426.16
8.2.290.0130.00420.21
8.2.280.0120.00818.39
8.2.270.0150.00416.99
8.2.260.0150.00316.89
8.2.250.0030.00618.45
8.2.240.0120.00617.26
8.2.230.0060.00320.94
8.2.220.0030.00637.54
8.2.210.0100.00726.77
8.2.200.0060.00318.79
8.2.190.0150.00316.58
8.2.180.0040.01125.92
8.2.170.0070.01022.96
8.2.160.0110.00322.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0080.00021.19
8.2.110.0030.00722.20
8.2.100.0040.00718.22
8.2.90.0030.00619.09
8.2.80.0030.00517.97
8.2.70.0050.00517.38
8.2.60.0050.00317.93
8.2.50.0030.00518.07
8.2.40.0040.00418.16
8.2.30.0080.00017.96
8.2.20.0000.00819.28
8.2.10.0000.00718.18
8.2.00.0080.00019.26
8.1.330.0090.00922.05
8.1.320.0080.01116.20
8.1.310.0050.00318.55
8.1.300.0030.01318.29
8.1.290.0030.00630.84
8.1.280.0140.00025.92
8.1.270.0080.00024.66
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0000.00922.01
8.1.230.0000.01119.04
8.1.220.0080.00017.79
8.1.210.0000.00818.77
8.1.200.0080.00017.35
8.1.190.0000.00917.48
8.1.180.0080.00018.10
8.1.170.0080.00318.77
8.1.160.0040.00418.82
8.1.150.0000.00718.73
8.1.140.0040.00417.57
8.1.130.0000.00717.61
8.1.120.0040.00417.49
8.1.110.0090.00017.46
8.1.100.0100.00017.65
8.1.90.0100.00817.47
8.1.80.0090.00617.46
8.1.70.0130.00317.46
8.1.60.0140.00517.71
8.1.50.0110.00717.71
8.1.40.0130.00717.69
8.1.30.0090.00917.87
8.1.20.0150.00317.71
8.1.10.0090.00917.60
8.1.00.0110.00717.60
8.0.300.0000.00719.85
8.0.290.0030.00716.75
8.0.280.0000.00820.26
8.0.270.0040.00418.22
8.0.260.0000.00616.93
8.0.250.0000.00717.00
8.0.240.0030.00317.14
8.0.230.0100.00517.05
8.0.220.0110.00516.90
8.0.210.0090.00616.98
8.0.200.0160.00017.02
8.0.190.0080.00816.98
8.0.180.0140.00017.07
8.0.170.0150.00017.04
8.0.160.0130.00317.02
8.0.150.0100.00916.96
8.0.140.0030.01216.91
8.0.130.0040.01316.84
8.0.120.0130.00216.89
8.0.110.0100.00717.08
8.0.100.0150.00016.89
8.0.90.0110.00416.83
8.0.80.0160.00017.05
8.0.70.0090.00916.92
8.0.60.0130.00217.01
8.0.50.0050.00916.91
8.0.30.0050.01017.01
8.0.20.0130.00316.99
8.0.10.0060.01017.20
7.4.330.0050.00015.55
7.4.320.0000.00616.83
7.4.300.0050.01116.74
7.4.290.0060.01016.81
7.4.280.0170.00016.66
7.4.270.0090.00816.72
7.4.260.0150.00316.59
7.4.250.0130.00416.78
7.4.240.0110.00216.70
7.4.230.0120.00416.77
7.4.220.0050.01116.66
7.4.210.0130.00016.82
7.4.200.0120.00016.60
7.4.190.0070.00716.68
7.4.180.0080.00816.84
7.4.160.0130.00316.80
7.4.150.0100.00616.78
7.4.140.0100.00616.75
7.4.130.0110.00516.67
7.4.120.0130.00316.82
7.4.110.0170.00016.66
7.4.100.0120.00416.80
7.4.90.0080.00816.57
7.4.80.0110.00416.64
7.4.70.0070.00816.83
7.4.60.0100.00516.73
7.4.50.0120.00316.55
7.4.40.0110.00416.57
7.4.30.0110.00516.76
7.4.20.0050.01016.67
7.4.10.0030.01316.74
7.4.00.0120.00416.69

preferences:
104.88 ms | 403 KiB | 5 Q