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 ''; } $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.0150.00416.75
8.3.50.0030.01018.18
8.3.40.0120.00318.75
8.3.30.0040.01118.71
8.3.20.0050.00318.74
8.3.10.0050.00321.96
8.3.00.0040.00421.76
8.2.180.0160.00016.50
8.2.170.0110.00422.96
8.2.160.0140.00019.18
8.2.150.0030.00524.18
8.2.140.0000.00724.66
8.2.130.0070.00026.16
8.2.120.0040.00422.34
8.2.110.0060.00322.20
8.2.100.0080.00417.59
8.2.90.0000.00820.61
8.2.80.0030.00519.11
8.2.70.0030.00617.80
8.2.60.0030.00617.97
8.2.50.0040.00418.10
8.2.40.0040.00419.26
8.2.30.0070.00019.24
8.2.20.0050.00317.96
8.2.10.0000.00817.98
8.2.00.0000.00717.60
8.1.280.0040.01125.92
8.1.270.0080.00022.21
8.1.260.0150.00426.35
8.1.250.0190.00028.09
8.1.240.0090.00022.42
8.1.230.0090.00320.85
8.1.220.0080.00017.74
8.1.210.0040.00418.89
8.1.200.0000.00917.22
8.1.190.0040.00417.10
8.1.180.0000.00818.10
8.1.170.0040.00418.53
8.1.160.0030.00518.68
8.1.150.0040.00418.85
8.1.140.0000.00719.54
8.1.130.0040.00417.67
8.1.120.0040.00417.38
8.1.110.0030.00617.33
8.1.100.0000.00817.43
8.1.90.0020.00517.40
8.1.80.0040.00417.44
8.1.70.0000.00717.41
8.1.60.0040.00417.48
8.1.50.0000.00817.41
8.1.40.0000.00817.44
8.1.30.0000.01017.62
8.1.20.0020.00517.62
8.1.10.0000.00717.46
8.1.00.0040.00417.34
8.0.300.0040.00419.83
8.0.290.0000.00716.88
8.0.280.0050.00218.29
8.0.270.0030.00317.11
8.0.260.0030.00317.07
8.0.250.0000.00716.95
8.0.240.0030.00516.83
8.0.230.0030.00516.80
8.0.220.0040.00416.90
8.0.210.0070.00016.91
8.0.200.0000.00716.88
8.0.190.0070.00316.82
8.0.180.0040.00416.92
8.0.170.0000.00816.81
8.0.160.0040.00416.89
8.0.150.0070.00016.81
8.0.140.0070.00016.82
8.0.130.0000.00513.29
8.0.120.0000.00816.74
8.0.110.0040.00416.84
8.0.100.0000.00716.94
8.0.90.0070.00016.75
8.0.80.0060.00916.82
8.0.70.0040.00416.71
8.0.60.0000.00716.95
8.0.50.0000.00816.92
8.0.30.0090.01017.04
8.0.20.0120.01117.40
8.0.10.0020.00516.96
8.0.00.0070.01716.61
7.4.330.0030.00315.55
7.4.320.0030.00316.77
7.4.300.0000.00716.79
7.4.290.0080.00716.77
7.4.280.0040.00416.87
7.4.270.0030.00516.64
7.4.260.0030.00416.86
7.4.250.0040.00416.88
7.4.240.0050.00216.77
7.4.230.0000.00716.68
7.4.220.0100.01016.82
7.4.210.0070.01016.75
7.4.200.0040.00416.78
7.4.160.0140.00316.79
7.4.150.0170.01217.40
7.4.140.0080.01417.86
7.4.130.0140.00816.81
7.4.120.0080.01016.82
7.4.110.0110.00916.88
7.4.100.0130.00616.80
7.4.90.0130.01016.96
7.4.80.0090.01319.39
7.4.70.0120.00916.74
7.4.60.0070.01016.77
7.4.50.0040.00716.77
7.4.40.0060.01216.85
7.4.30.0030.01416.93
7.4.00.0030.00915.25
7.3.330.0030.00313.66
7.3.320.0000.00513.53
7.3.310.0040.00416.53
7.3.300.0030.00316.60
7.3.290.0090.01016.61
7.3.280.0090.00916.59
7.3.270.0160.00617.40
7.3.260.0100.00716.71
7.3.250.0080.00916.60
7.3.240.0130.00616.79
7.3.230.0130.00316.45
7.3.210.0140.00316.62
7.3.200.0040.01216.93
7.3.190.0120.01216.62
7.3.180.0060.00916.86
7.3.170.0100.00716.85
7.3.160.0080.00916.81
7.2.330.0070.01016.94
7.2.320.0070.01616.88
7.2.310.0060.01116.89
7.2.300.0080.01117.00
7.2.290.0160.00316.91
7.2.80.0080.00416.65
7.2.60.0130.00017.21
7.1.200.0060.00915.71
7.1.70.0040.00417.42
7.1.60.0070.00717.63
7.1.50.0060.00617.41
7.1.40.0070.00417.41
7.1.30.0040.00717.41
7.1.20.0000.01017.41
7.1.10.0040.00417.41
7.1.00.0000.00817.41
7.0.200.0060.00317.41
7.0.190.0000.01017.41
7.0.180.0070.00317.41
7.0.170.0040.01117.41
7.0.160.0000.00717.41
7.0.150.0040.00417.41
7.0.140.0040.00717.41
7.0.130.0060.00617.41
7.0.120.0070.00417.41
7.0.110.0000.00817.41
7.0.100.0000.00817.41
7.0.90.0000.00717.41
7.0.80.0040.00417.41
7.0.70.0040.00717.41
7.0.60.0030.00517.41
7.0.50.0000.00817.41
7.0.40.0040.00417.41
7.0.30.0030.01017.41
7.0.20.0040.00417.41
7.0.10.0030.00517.41
7.0.00.0000.00717.41
5.6.300.0030.04120.96
5.6.290.0000.04420.84
5.6.280.0030.04020.94
5.6.270.0070.04021.06
5.6.260.0100.03821.03
5.6.250.0060.03920.89
5.6.240.0000.05120.92
5.6.230.0070.04620.94
5.6.220.0030.04020.95
5.6.210.0000.05120.86
5.6.200.0030.04520.84
5.6.190.0030.04020.88
5.6.180.0000.05520.76
5.6.170.0060.03621.05
5.6.160.0070.03920.86
5.6.150.0030.04621.04
5.6.140.0000.04420.97
5.6.130.0070.04220.84
5.6.120.0070.03720.88
5.6.110.0070.04121.05
5.6.100.0030.04120.93
5.6.90.0000.04520.82
5.6.80.0000.05320.26
5.6.70.0030.04820.22
5.6.60.0070.03620.32
5.6.50.0030.03920.33
5.6.40.0030.03820.37
5.6.30.0000.04220.40
5.6.20.0000.04220.36
5.6.10.0000.04120.20
5.6.00.0030.04420.18

preferences:
70.44 ms | 401 KiB | 5 Q