3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wp_kses_split( $string, $allowed_html, $allowed_protocols ) { return preg_replace_callback( '%(<!--.*?(-->|$))|(<[^>]*(>|$)|>)%', function( $match ) use ($allowed_html, $allowed_protocols) { return wp_kses_split2( $match[0], $allowed_html, $allowed_protocols ); }, $string ); } function wp_kses_split2($string, $allowed_html, $allowed_protocols) { $string = str_replace( '\\"', '"', $string ); if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9]+)([^>]*)>?$%', $string, $matches)) { return ''; } $slash = trim($matches[1]); $elem = $matches[2]; $attrlist = $matches[3]; if ($slash != '') return "</$elem>"; return wp_kses_attr( $elem, $attrlist, $allowed_html, $allowed_protocols ); } function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) { $attrarr = array( array( 'name' => 'style', 'value' => '', 'whole' => "name=''", 'vless' => 'style' ) ); // Go through $attrarr, and save the allowed attributes for this element // in $attr2 $attr2 = ''; foreach ( $attrarr as $arreach ) { if ( wp_kses_attr_check( $arreach['name'], $arreach['value'], $arreach['whole'], $arreach['vless'], $element, $allowed_html ) ) { $attr2 .= ' '.$arreach['whole']; } } return "<$element$attr2>"; } function wp_kses_attr_check( &$name, &$value, &$whole, $vless, $element, $allowed_html ) { $allowed_attr = $allowed_html[strtolower( $element )]; $name_low = strtolower( $name ); if ( ! isset( $allowed_attr[$name_low] ) || '' == $allowed_attr[$name_low] ) { $name = $value = $whole = ''; return false; } if ( 'style' == $name_low ) { $new_value = safecss_filter_attr( $value ); if ( empty( $new_value ) ) { $name = $value = $whole = ''; return false; } $whole = str_replace( $value, $new_value, $whole ); $value = $new_value; } return true; } function safecss_filter_attr( $css, $element = 'div' ) { $css = $element . ' {' . $css . '}'; $css = wp_kses_split( $css, array(), array() ); $old = @setlocale(LC_ALL, 0); @setlocale(LC_ALL, 'C'); preg_match( "/[^\s\r\n\t\f]/", $css{0} ); @setlocale(LC_ALL, $old); return ''; } var_dump(PCRE_VERSION); $content = '<p style="">hola</p><p style="">hola</p>'; var_dump( wp_kses_split( addslashes( $content ), array('p'=>array('style' => array())), array() ) );

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.3.60.0160.00617.00
8.3.50.0070.01418.18
8.3.40.0170.00318.70
8.3.30.0040.01118.45
8.3.20.0050.00320.54
8.3.10.0040.00421.91
8.3.00.0040.00421.66
8.2.180.0170.00318.29
8.2.170.0140.00022.96
8.2.160.0070.00720.53
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0000.00719.54
8.2.120.0040.00426.35
8.2.110.0030.00622.32
8.2.100.0040.00817.59
8.2.90.0040.00422.18
8.2.80.0040.00417.97
8.2.70.0030.00617.91
8.2.60.0000.00817.68
8.2.50.0030.00618.10
8.2.40.0000.00820.60
8.2.30.0000.01019.18
8.2.20.0040.00418.05
8.2.10.0060.00317.97
8.2.00.0000.00717.42
8.1.280.0120.00925.92
8.1.270.0030.00622.21
8.1.260.0080.00028.09
8.1.250.0080.00028.09
8.1.240.0060.00322.35
8.1.230.0110.00020.89
8.1.220.0040.00417.74
8.1.210.0050.00318.88
8.1.200.0030.00517.10
8.1.190.0030.00617.10
8.1.180.0040.00420.24
8.1.170.0050.00318.46
8.1.160.0040.00418.80
8.1.150.0070.00020.32
8.1.140.0050.00219.45
8.1.130.0070.00017.48
8.1.120.0040.00417.38
8.1.110.0040.00417.36
8.1.100.0040.00417.43
8.1.90.0000.00717.30
8.1.80.0000.00817.38
8.1.70.0000.00817.27
8.1.60.0040.00417.53
8.1.50.0030.00617.50
8.1.40.0040.00417.46
8.1.30.0000.00817.55
8.1.20.0030.00517.63
8.1.10.0040.00417.48
8.1.00.0000.00717.31
8.0.300.0040.00419.89
8.0.290.0000.00816.88
8.0.280.0050.00218.30
8.0.270.0000.00817.15
8.0.260.0000.00616.73
8.0.250.0000.00716.96
8.0.240.0070.00016.91
8.0.230.0030.00516.83
8.0.220.0020.00516.91
8.0.210.0040.00416.84
8.0.200.0040.00416.78
8.0.190.0070.00316.96
8.0.180.0040.00416.95
8.0.170.0050.00316.96
8.0.160.0040.00416.81
8.0.150.0000.00716.82
8.0.140.0000.00716.85
8.0.130.0000.00813.39
8.0.120.0040.00416.90
8.0.110.0080.00016.88
8.0.100.0000.00716.79
8.0.90.0020.00516.95
8.0.80.0040.01416.86
8.0.70.0040.00416.82
8.0.60.0000.00816.76
8.0.50.0030.00516.76
8.0.30.0100.00717.08
8.0.20.0130.00917.40
8.0.10.0030.00616.89
8.0.00.0000.01716.66
7.4.330.0000.00615.55
7.4.320.0030.00316.90
7.4.300.0000.00616.90
7.4.290.0090.00016.79
7.4.280.0040.00416.84
7.4.270.0000.00816.88
7.4.260.0040.00416.77
7.4.250.0040.00416.71
7.4.240.0050.00216.77
7.4.230.0000.00717.00
7.4.220.0120.01216.74
7.4.210.0090.00616.92
7.4.200.0000.00716.91
7.4.160.0170.00316.87
7.4.150.0140.00717.40
7.4.140.0100.01217.86
7.4.130.0150.00516.88
7.4.120.0090.00916.89
7.4.110.0170.00016.84
7.4.100.0070.01016.88
7.4.90.0120.00616.91
7.4.80.0060.01219.39
7.4.70.0090.00916.84
7.4.60.0160.00616.82
7.4.50.0100.00217.00
7.4.40.0040.01516.84
7.4.30.0120.00616.70
7.4.10.0100.00715.45
7.4.00.0070.01015.00
7.3.330.0050.00013.52
7.3.320.0030.00313.53
7.3.310.0050.00216.62
7.3.300.0030.00316.47
7.3.290.0090.00616.60
7.3.280.0060.01516.55
7.3.270.0110.01117.40
7.3.260.0120.00616.70
7.3.250.0080.01216.62
7.3.240.0080.01116.68
7.3.230.0110.00716.51
7.3.210.0150.00916.57
7.3.200.0090.00816.52
7.3.190.0060.01316.63
7.3.180.0040.01216.53
7.3.170.0150.00316.83
7.3.160.0090.01516.66
7.3.130.0030.01615.29
7.3.120.0110.00414.87
7.3.110.0140.00415.27
7.3.100.0030.01315.05
7.3.90.0090.00614.94
7.3.80.0030.01015.06
7.3.70.0060.00915.13
7.3.60.0110.00415.14
7.3.50.0040.01115.20
7.3.40.0000.01115.16
7.3.30.0120.00314.99
7.3.20.0060.01116.96
7.3.10.0130.00716.93
7.3.00.0030.01016.76
7.2.330.0090.00916.94
7.2.320.0080.01116.87
7.2.310.0030.01316.94
7.2.300.0070.01716.95
7.2.290.0090.01216.96
7.2.260.0030.01315.21
7.2.250.0120.00615.23
7.2.240.0100.01015.38
7.2.230.0030.01315.45
7.2.220.0030.00915.53
7.2.210.0060.00915.27
7.2.200.0060.01015.56
7.2.190.0080.00815.41
7.2.180.0060.01015.23
7.2.170.0070.01115.23
7.2.160.0060.01315.31
7.2.150.0030.01617.32
7.2.140.0070.01017.14
7.2.130.0000.01317.21
7.2.120.0050.00517.19
7.2.110.0040.00817.30
7.2.100.0030.00917.16
7.2.90.0060.01017.08
7.2.80.0120.00316.97
7.2.70.0060.00917.25
7.2.60.0080.00917.01
7.2.50.0090.00916.95
7.2.40.0090.00317.27
7.2.30.0070.01117.06
7.2.20.0030.00616.90
7.2.10.0060.00917.14
7.2.00.0090.00618.44
7.1.330.0070.01115.90
7.1.320.0040.00916.27
7.1.310.0080.00816.05
7.1.300.0070.00716.03
7.1.290.0030.01215.90
7.1.280.0030.01015.73
7.1.270.0100.01015.97
7.1.260.0030.01015.98
7.1.250.0040.00816.10
7.1.240.0030.00616.11
7.1.230.0060.00616.13
7.1.220.0000.00916.07
7.1.210.0120.00315.84
7.1.200.0090.00516.08
7.1.190.0040.01115.98
7.1.180.0090.00316.00
7.1.170.0070.00716.14
7.1.160.0100.00315.99
7.1.150.0070.00715.97
7.1.140.0070.00715.91
7.1.130.0040.00416.06
7.1.120.0030.01416.07
7.1.110.0060.00316.06
7.1.100.0060.00517.26
7.1.90.0070.00715.96
7.1.80.0060.00615.94
7.1.70.0030.00916.65
7.1.60.0070.00316.50
7.1.50.0070.00625.36
7.1.40.0070.00716.07
7.1.30.0030.00816.05
7.1.20.0100.00316.09
7.1.10.0000.01416.11
7.1.00.0050.04019.22
7.0.330.0070.00715.72
7.0.320.0080.00815.61
7.0.310.0070.01015.18
7.0.300.0030.01215.66
7.0.290.0070.00715.74
7.0.280.0060.01015.67
7.0.270.0060.00915.67
7.0.260.0100.00315.53
7.0.250.0040.00815.34
7.0.240.0060.00615.82
7.0.230.0040.01115.39
7.0.220.0090.00615.60
7.0.210.0060.00915.85
7.0.200.0110.00716.04
7.0.190.0060.00315.57
7.0.180.0060.01015.41
7.0.170.0070.00715.45
7.0.160.0130.00015.68
7.0.150.0030.01315.61
7.0.140.0070.00415.72
7.0.130.0030.01015.41
7.0.120.0100.02718.95
7.0.110.0100.03018.82
7.0.100.0070.03918.90
7.0.90.0080.02819.00
7.0.80.0050.03218.88
7.0.70.0080.03118.70
7.0.60.0080.03318.88
7.0.50.0030.03318.86
7.0.40.0070.03017.82
7.0.30.0000.03517.98
7.0.20.0050.03017.77
7.0.10.0060.03117.77
7.0.00.0050.03117.88
5.6.400.0040.01114.86
5.6.390.0060.00914.87
5.6.380.0060.00314.90
5.6.370.0060.00914.91
5.6.360.0060.00614.65
5.6.350.0070.00714.83
5.6.340.0060.00614.68
5.6.330.0060.00914.62
5.6.320.0000.01014.69
5.6.310.0100.00614.44
5.6.300.0040.00714.86
5.6.290.0030.01314.77
5.6.280.0000.01114.23
5.6.270.0100.02517.91
5.6.260.0080.02817.97
5.6.250.0000.03817.79
5.6.240.0080.03517.82
5.6.230.0030.03417.66
5.6.220.0050.03217.78
5.6.210.0030.03617.69
5.6.200.0040.03517.93
5.6.190.0100.03017.90
5.6.180.0020.03517.86
5.6.170.0050.03217.84
5.6.160.0060.03117.66
5.6.150.0090.02917.83
5.6.140.0030.04517.89
5.6.130.0070.03417.76
5.6.120.0070.03017.72
5.6.110.0100.02617.71
5.6.100.0020.03417.98
5.6.90.0080.02817.66
5.6.80.0080.02617.38
5.6.70.0070.02917.38
5.6.60.0110.02517.52
5.6.50.0120.02517.34
5.6.40.0050.02917.49
5.6.30.0070.03017.52
5.6.20.0070.03117.23
5.6.10.0050.03017.49
5.6.00.0100.02617.33

preferences:
92.05 ms | 401 KiB | 5 Q