3v4l.org

run code in 200+ 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() ) );
based on SM0Il

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)
7.4.10.0100.00715.45
7.4.00.0070.01015.00
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.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