3v4l.org

run code in 300+ PHP versions simultaneously
<?php function wd_check_serialization( $string, &$errmsg ) { $str = 's'; $array = 'a'; $integer = 'i'; $any = '[^}]*?'; $count = '\d+'; $content = '"(?:\\\";|.)*?";'; $open_tag = '\{'; $close_tag = '\}'; $parameter = "($str|$array|$integer|$any):($count)" . "(?:[:]($open_tag|$content)|[;])"; $preg = "/$parameter|($close_tag)/"; if( !preg_match_all( $preg, $string, $matches ) ) { $errmsg = 'not a serialized string'; return false; } $open_arrays = 0; foreach( $matches[1] AS $key => $value ) { if( !empty( $value ) && ( $value != $array xor $value != $str xor $value != $integer ) ) { $errmsg = 'undefined datatype'; return false; } if( $value == $array ) { $open_arrays++; if( $matches[3][$key] != '{' ) { $errmsg = 'open tag expected'; return false; } } if( $value == '' ) { if( $matches[4][$key] != '}' ) { $errmsg = 'close tag expected'; return false; } $open_arrays--; } if( $value == $str ) { $aVar = ltrim( $matches[3][$key], '"' ); $aVar = rtrim( $aVar, '";' ); if( strlen( $aVar ) != $matches[2][$key] ) { $errmsg = 'stringlen for string not match'; return false; } } if( $value == $integer ) { if( !empty( $matches[3][$key] ) ) { $errmsg = 'unexpected data'; return false; } if( !is_integer( (int)$matches[2][$key] ) ) { $errmsg = 'integer expected'; return false; } } } if( $open_arrays != 0 ) { $errmsg = 'wrong setted arrays'; return false; } return true; } var_dump(wd_check_serialization('a:1:{i:0;a:10:{s:2:"id";s:3:"191";s:12:"variation_id";s:3:"193";s:4:"name";s:42:"Serviette Havana Club mit Gastro-Logodruck";s:3:"qty";s:1:"1";s:9:"item_meta";a:2:{i:0;a:2:{s:9:"meta_name";s:6:"pa_vpe";s:10:"meta_value";s:6:"18-900";}i:1;a:2:{s:9:"meta_name";s:12:"pa_erstdruck";s:10:"meta_value";s:4:"nein";}}s:13:"line_subtotal";s:3:"360";s:17:"line_subtotal_tax";s:4:"68.4";s:10:"line_total";s:3:"360";s:8:"line_tax";s:4:"68.4";s:9:"tax_class";s:19:"gesetzliche-mwst-19";}}"'));

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.70.0110.01116.47
8.3.60.0080.00816.75
8.3.50.0120.00522.06
8.3.40.0040.01118.60
8.3.30.0040.01119.18
8.3.20.0000.00820.39
8.3.10.0000.00723.52
8.3.00.0050.00319.35
8.2.180.0070.00718.27
8.2.170.0070.00722.96
8.2.160.0100.00320.35
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0160.00326.16
8.2.120.0040.00422.25
8.2.110.0060.00322.21
8.2.100.0040.00817.80
8.2.90.0050.00319.28
8.2.80.0030.00617.97
8.2.70.0030.00617.38
8.2.60.0090.00017.93
8.2.50.0000.00818.07
8.2.40.0080.00019.54
8.2.30.0000.00717.95
8.2.20.0030.00617.64
8.2.10.0040.00417.91
8.2.00.0020.00417.81
8.1.280.0150.00725.92
8.1.270.0040.00423.92
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0100.00023.67
8.1.230.0040.00719.17
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0030.00617.38
8.1.190.0050.00317.30
8.1.180.0030.00618.10
8.1.170.0030.00718.56
8.1.160.0040.00421.96
8.1.150.0000.00718.61
8.1.140.0070.00417.43
8.1.130.0030.00317.84
8.1.120.0040.00417.38
8.1.110.0030.00717.27
8.1.100.0030.00617.33
8.1.90.0040.00417.27
8.1.80.0030.00317.32
8.1.70.0030.00317.36
8.1.60.0030.00617.56
8.1.50.0030.00517.50
8.1.40.0040.00417.45
8.1.30.0000.00817.48
8.1.20.0000.00817.57
8.1.10.0080.00017.45
8.1.00.0040.00417.38
8.0.300.0040.00419.09
8.0.290.0040.00417.29
8.0.280.0030.00318.43
8.0.270.0000.00717.20
8.0.260.0000.00817.26
8.0.250.0000.01116.98
8.0.240.0030.00517.00
8.0.230.0030.00517.02
8.0.220.0040.00416.92
8.0.210.0030.00316.94
8.0.200.0000.00616.98
8.0.190.0040.00416.99
8.0.180.0000.00716.89
8.0.170.0040.00416.98
8.0.160.0050.00216.91
8.0.150.0000.00716.80
8.0.140.0070.00016.84
8.0.130.0000.00613.43
8.0.120.0080.00016.79
8.0.110.0020.00516.80
8.0.100.0070.00016.78
8.0.90.0050.00316.83
8.0.80.0080.01216.87
8.0.70.0000.00716.89
8.0.60.0070.00016.97
8.0.50.0000.00716.74
8.0.30.0130.01017.01
8.0.20.0130.00717.40
8.0.10.0030.00516.86
8.0.00.0130.00516.95
7.4.330.0000.00515.00
7.4.320.0000.00616.42
7.4.300.0030.00316.51
7.4.290.0030.00316.34
7.4.280.0000.00816.61
7.4.270.0050.00316.54
7.4.260.0070.00016.64
7.4.250.0000.00816.57
7.4.240.0020.00616.60
7.4.230.0000.00716.66
7.4.220.0120.00316.52
7.4.210.0080.01116.56
7.4.200.0070.00016.38
7.4.190.0040.00416.48
7.4.160.0130.00316.45
7.4.150.0150.01117.40
7.4.140.0100.00717.86
7.4.130.0060.01416.64
7.4.120.0070.01016.54
7.4.110.0070.01516.52
7.4.100.0100.01016.62
7.4.90.0130.00316.65
7.4.80.0060.01319.39
7.4.70.0080.00816.52
7.4.60.0150.00316.29
7.4.50.0050.00316.27
7.4.40.0120.00322.77
7.4.30.0070.01116.53
7.4.00.0070.01014.65
7.3.330.0030.00313.44
7.3.320.0040.00313.16
7.3.310.0040.00416.34
7.3.300.0040.00416.35
7.3.290.0150.00616.27
7.3.280.0070.00916.33
7.3.270.0080.00817.40
7.3.260.0040.01416.27
7.3.250.0110.01016.41
7.3.240.0090.00816.47
7.3.230.0110.01116.42
7.3.210.0090.01416.53
7.3.200.0100.01219.39
7.3.190.0080.00816.40
7.3.180.0100.01016.32
7.3.170.0110.00516.44
7.3.160.0100.00616.35
7.3.120.0060.01014.84
7.2.330.0160.00016.69
7.2.320.0110.00616.60
7.2.310.0100.00616.41
7.2.300.0120.00916.49
7.2.290.0120.00816.40
7.2.60.0060.01016.38
7.2.00.0000.01319.07
7.1.200.0040.00815.46
7.1.100.0070.01017.87
7.1.70.0070.00716.77
7.1.60.0130.00619.46
7.1.50.0070.01416.67
7.1.00.0030.07722.43
7.0.200.0270.00615.07
7.0.140.0000.07721.99
7.0.60.0170.08021.86
7.0.50.0100.05717.93
7.0.40.0070.05720.12
7.0.30.0400.05320.27
7.0.20.0130.09020.35
7.0.10.0130.03320.35
7.0.00.0100.04720.35
5.6.280.0000.07321.16
5.6.210.0030.08320.53
5.6.200.0130.07018.18
5.6.190.0000.09320.68
5.6.180.0230.04720.52
5.6.170.0300.07720.58
5.6.160.0130.03320.55
5.6.150.0070.08318.20
5.6.140.0100.08318.17
5.6.130.0070.05718.28
5.6.120.0070.05321.02
5.6.110.0100.03721.04
5.6.100.0000.06321.00
5.6.90.0270.06720.98
5.6.80.0170.06720.32
5.5.350.0130.04020.36
5.5.340.0070.03717.93
5.5.330.0030.04020.42
5.5.320.0300.05020.38
5.5.310.0230.04020.24
5.5.300.0070.05017.96
5.5.290.0000.04717.95
5.5.280.0130.08320.88
5.5.270.0030.04320.90
5.5.260.0100.07020.80
5.5.250.0030.08320.82
5.5.240.0170.08020.23
5.4.450.0300.04019.40
5.4.440.0370.07319.37
5.4.430.0200.05319.43
5.4.420.0330.07019.55
5.4.410.0470.04319.33
5.4.400.0300.04018.96
5.4.390.0300.05719.18
5.4.380.0300.05319.17
5.4.370.0370.06019.22
5.4.360.0300.05319.18
5.4.350.0270.05718.93
5.4.340.0300.04319.20
5.4.320.0230.06319.20
5.4.310.0030.05019.06
5.4.300.0330.03319.14
5.4.290.0270.07319.24
5.4.280.0300.05719.22
5.4.270.0400.06719.22
5.4.260.0300.06019.20
5.4.250.0200.04318.96
5.4.240.0300.07319.12
5.4.230.0270.05019.05
5.4.220.0330.05019.14
5.4.210.0500.05318.94
5.4.200.0330.06719.10
5.4.190.0370.03719.16
5.4.180.0270.04019.21
5.4.170.0270.03719.19
5.4.160.0270.03719.21
5.4.150.0300.04019.16
5.4.140.0400.05716.52
5.4.130.0300.06316.44
5.4.120.0200.04016.30
5.4.110.0300.07016.31
5.4.100.0330.04016.53
5.4.90.0270.06016.57
5.4.80.0230.03716.55
5.4.70.0330.04316.59
5.4.60.0400.06716.38
5.4.50.0300.07016.50
5.4.40.0370.06316.34
5.4.30.0270.05716.54
5.4.20.0300.03316.38
5.4.10.0370.06716.49
5.4.00.0470.05715.84
5.3.290.0270.07314.71
5.3.280.0370.05314.79
5.3.270.0330.06714.68
5.3.260.0270.06314.65
5.3.250.0230.04014.54
5.3.240.0400.04014.63
5.3.230.0230.04314.66
5.3.220.0370.06014.64
5.3.210.0370.06314.62
5.3.200.0330.07714.63
5.3.190.0330.03314.50
5.3.180.0230.04014.61
5.3.170.0300.03314.61
5.3.160.0300.06714.64
5.3.150.0330.04714.61
5.3.140.0270.07014.60
5.3.130.0230.04014.59
5.3.120.0330.06314.67
5.3.110.0330.04314.61
5.3.100.0330.06314.22
5.3.90.0330.07014.12
5.3.80.0400.06314.08
5.3.70.0270.06314.12
5.3.60.0300.05014.21
5.3.50.0270.04313.96
5.3.40.0300.07013.99
5.3.30.0230.07314.01
5.3.20.0330.06713.89
5.3.10.0370.06313.73
5.3.00.0300.06013.73
5.2.170.0270.05711.13
5.2.160.0200.03711.09
5.2.150.0200.03311.14
5.2.140.0200.05011.27
5.2.130.0270.05711.07
5.2.120.0200.06011.21
5.2.110.0370.03311.22
5.2.100.0230.06011.20
5.2.90.0200.03311.16
5.2.80.0230.03011.11
5.2.70.0300.03711.18
5.2.60.0300.05711.11
5.2.50.0270.04711.22
5.2.40.0230.05710.96
5.2.30.0170.03711.02
5.2.20.0200.05011.04
5.2.10.0200.03010.96
5.2.00.0200.05710.78
5.1.60.0230.03310.00
5.1.50.0170.03010.14
5.1.40.0230.02710.13
5.1.30.0300.02310.43
5.1.20.0200.05310.45
5.1.10.0230.04310.21
5.1.00.0300.03710.19
5.0.50.0030.0278.68
5.0.40.0070.0278.68
5.0.30.0100.0638.68
5.0.20.0130.0208.68
5.0.10.0130.0408.68
5.0.00.0100.0408.68
4.4.90.0100.0378.68
4.4.80.0100.0378.68
4.4.70.0070.0208.68
4.4.60.0100.0278.68
4.4.50.0100.0338.68
4.4.40.0070.0338.68
4.4.30.0100.0378.68
4.4.20.0130.0138.68
4.4.10.0170.0278.68
4.4.00.0100.0278.68
4.3.110.0130.0138.68
4.3.100.0100.0178.68
4.3.90.0130.0278.68
4.3.80.0100.0378.68
4.3.70.0100.0178.68
4.3.60.0130.0338.68
4.3.50.0170.0208.68
4.3.40.0100.0278.68
4.3.30.0070.0278.68
4.3.20.0070.0238.68
4.3.10.0100.0208.68
4.3.00.0070.0208.68

preferences:
50.27 ms | 401 KiB | 5 Q