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:"390";s:12:"variation_id";s:3:"393";s:4:"name";s:38:"Serviette Absolut mit Gastro-Logodruck";s:3:"qty";s:1:"1";s:9:"item_meta";a:3:{i:0;a:2:{s:9:"meta_name";s:51:"Geben Sie bitte hier die gewünschte Zusatzfarbe an";s:10:"meta_value";s:12:"schwarzgold";}i:1;a:2:{s:9:"meta_name";s:6:"pa_vpe";s:10:"meta_value";s:6:"18-900";}i:2;a:2:{s:9:"meta_name";s:12:"pa_erstdruck";s:10:"meta_value";s:2:"ja";}}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.60.0140.00716.88
8.3.50.0070.01322.13
8.3.40.0190.00318.97
8.3.30.0090.00919.11
8.3.20.0000.00820.18
8.3.10.0080.00023.66
8.3.00.0080.00019.38
8.2.180.0180.00318.30
8.2.170.0070.00722.96
8.2.160.0040.01120.50
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0090.00626.16
8.2.120.0040.00422.13
8.2.110.0090.00022.07
8.2.100.0080.00417.91
8.2.90.0000.00819.09
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0000.00917.93
8.2.50.0000.00818.07
8.2.40.0030.00619.76
8.2.30.0000.00717.92
8.2.20.0040.00417.87
8.2.10.0040.00417.95
8.2.00.0040.00717.66
8.1.280.0090.00925.92
8.1.270.0000.00823.84
8.1.260.0050.00326.35
8.1.250.0050.00228.09
8.1.240.0030.00623.91
8.1.230.0090.00318.93
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0070.00317.22
8.1.190.0000.00817.30
8.1.180.0080.00018.10
8.1.170.0060.00318.59
8.1.160.0000.00722.00
8.1.150.0000.00818.62
8.1.140.0000.00917.42
8.1.130.0000.00717.73
8.1.120.0040.00317.37
8.1.110.0030.00717.28
8.1.100.0080.00017.40
8.1.90.0070.00017.30
8.1.80.0070.00017.28
8.1.70.0000.00717.30
8.1.60.0030.00617.61
8.1.50.0000.00817.39
8.1.40.0080.00017.55
8.1.30.0040.00417.54
8.1.20.0030.00517.68
8.1.10.0000.00817.43
8.1.00.0050.00217.47
8.0.300.0040.00419.12
8.0.290.0000.00717.16
8.0.280.0080.00018.34
8.0.270.0040.00417.12
8.0.260.0030.00317.15
8.0.250.0030.00616.87
8.0.240.0040.00416.88
8.0.230.0050.00316.94
8.0.220.0070.00016.98
8.0.210.0050.00316.93
8.0.200.0000.00716.89
8.0.190.0030.00616.99
8.0.180.0040.00416.85
8.0.170.0030.00516.85
8.0.160.0040.00417.01
8.0.150.0000.00716.91
8.0.140.0040.00416.95
8.0.130.0060.00013.35
8.0.120.0080.00016.86
8.0.110.0030.00516.93
8.0.100.0000.00816.93
8.0.90.0050.00216.93
8.0.80.0030.01316.89
8.0.70.0070.00016.84
8.0.60.0040.00416.83
8.0.50.0040.00416.78
8.0.30.0140.00617.31
8.0.20.0110.00817.40
8.0.10.0050.00216.94
8.0.00.0080.00916.85
7.4.330.0000.00515.03
7.4.320.0060.00016.36
7.4.300.0030.00316.59
7.4.290.0040.00416.50
7.4.280.0030.00516.48
7.4.270.0030.00616.57
7.4.260.0000.00816.44
7.4.250.0000.00716.44
7.4.240.0040.00416.58
7.4.230.0070.00016.39
7.4.220.0090.00616.48
7.4.210.0080.00716.56
7.4.200.0040.00416.64
7.4.190.0000.00716.59
7.4.160.0120.01216.43
7.4.150.0100.00917.40
7.4.140.0110.00617.86
7.4.130.0120.00516.60
7.4.120.0090.01016.53
7.4.110.0100.00716.42
7.4.100.0090.00916.47
7.4.90.0100.00716.57
7.4.80.0170.00019.39
7.4.70.0040.01616.51
7.4.60.0070.01116.43
7.4.50.0040.00416.37
7.4.40.0060.00922.77
7.4.30.0120.00616.59
7.4.00.0170.00014.92
7.3.330.0000.00613.30
7.3.320.0040.00313.31
7.3.310.0030.00316.23
7.3.300.0000.00716.25
7.3.290.0100.01016.32
7.3.280.0040.01216.30
7.3.270.0100.01417.40
7.3.260.0140.00416.62
7.3.250.0110.01016.45
7.3.240.0120.00916.39
7.3.230.0060.01516.44
7.3.210.0140.00316.45
7.3.200.0160.00619.39
7.3.190.0090.00916.50
7.3.180.0090.00616.38
7.3.170.0120.00416.35
7.3.160.0130.00616.52
7.3.120.0100.00014.74
7.2.330.0140.00416.60
7.2.320.0090.00916.39
7.2.310.0140.00616.56
7.2.300.0170.00716.63
7.2.290.0090.01216.53
7.2.60.0090.00616.86
7.2.00.0040.01118.75
7.1.200.0040.00715.66
7.1.100.0040.01117.50
7.1.70.0100.00616.84
7.1.60.0120.01219.46
7.1.50.0100.01016.71
7.1.00.0000.08022.35
7.0.200.0340.00715.18
7.0.140.0030.07321.95
7.0.100.0430.07320.07
7.0.90.0430.08319.99
7.0.80.0500.08320.18
7.0.70.0500.07719.88
7.0.60.0630.07719.96
7.0.50.0500.08020.24
7.0.40.0000.06020.09
7.0.30.0070.08720.14
7.0.20.0070.08020.12
7.0.10.0100.08019.99
7.0.00.0100.08320.09
5.6.280.0070.07021.06
5.6.250.0070.08320.77
5.6.240.0070.08320.65
5.6.230.0070.08020.70
5.6.220.0030.08320.59
5.6.210.0030.07720.69
5.6.200.0100.09020.98
5.6.190.0070.04720.96
5.6.180.0000.04721.08
5.6.170.0170.06721.12
5.6.160.0130.07721.13
5.6.150.0100.07721.13
5.6.140.0130.07320.97
5.6.130.0070.06020.98
5.6.120.0070.05321.05
5.6.110.0100.06020.97
5.6.100.0200.06321.14
5.6.90.0000.09320.97
5.6.80.0070.08020.51
5.6.70.0130.04720.46
5.6.60.0070.08020.47
5.6.50.0070.07720.48
5.6.40.0200.06320.50
5.6.30.0170.03720.48
5.6.20.0100.06020.43
5.6.10.0070.08020.35
5.6.00.0130.06720.49
5.5.380.0270.06720.45
5.5.370.0070.08020.48
5.5.360.0000.07320.42
5.5.350.0030.08720.48
5.5.340.0130.07720.82
5.5.330.0130.07020.87
5.5.320.0000.09020.97
5.5.310.0170.06720.87
5.5.300.0130.07320.96
5.5.290.0070.07720.90
5.5.280.0070.08020.92
5.5.270.0000.09020.94
5.5.260.0070.06020.83
5.5.250.0100.08020.63
5.5.240.0100.08020.23
5.5.230.0130.07020.31
5.5.220.0070.08320.21
5.5.210.0170.06720.19
5.5.200.0100.07720.13
5.5.190.0070.08020.12
5.5.180.0130.07020.15
5.5.160.0030.08020.19
5.5.150.0000.08320.19
5.5.140.0000.08020.21
5.5.130.0030.05320.16
5.5.120.0130.04720.16
5.5.110.0070.08020.28
5.5.100.0130.07320.17
5.5.90.0070.07020.21
5.5.80.0030.05020.20
5.5.70.0030.05020.13
5.5.60.0100.07020.20
5.5.50.0130.07020.09
5.5.40.0070.07320.07
5.5.30.0030.05020.18
5.5.20.0070.05320.00
5.5.10.0030.06720.08
5.5.00.0030.04320.17
5.4.450.0030.09019.36
5.4.440.0070.08019.45
5.4.430.0070.08019.41
5.4.420.0030.07319.23
5.4.410.0070.08019.43
5.4.400.0130.06718.87
5.4.390.0070.07719.13
5.4.380.0200.03718.90
5.4.370.0000.04319.24
5.4.360.0070.08018.90
5.4.350.0070.07719.18
5.4.340.0030.08019.14
5.4.320.0100.07018.89
5.4.310.0030.03319.00
5.4.300.0030.07318.85
5.4.290.0000.05718.92
5.4.280.0070.06719.13
5.4.270.0070.07319.13
5.4.260.0170.06719.09
5.4.250.0130.06319.23
5.4.240.0100.07018.84
5.4.230.0070.07018.84
5.4.220.0070.08018.90
5.4.210.0100.07019.03
5.4.200.0030.05319.16
5.4.190.0030.06319.17
5.4.180.0030.04318.84
5.4.170.0070.03719.02
5.4.160.0000.04019.08
5.4.150.0070.03318.88
5.4.140.0070.03316.44
5.4.130.0000.04016.44
5.4.120.0070.03316.34
5.4.110.0100.05716.38
5.4.100.0030.03316.45
5.4.90.0070.05316.45
5.4.80.0000.03716.60
5.4.70.0030.03716.43
5.4.60.0100.03016.37
5.4.50.0030.06716.42
5.4.40.0070.03316.50
5.4.30.0030.03316.53
5.4.20.0030.03716.45
5.4.10.0100.03016.41
5.4.00.0030.03315.87
5.3.290.0070.07714.70
5.3.280.0030.08014.58
5.3.270.0070.03714.75
5.3.260.0070.05314.73
5.3.250.0070.03314.61
5.3.240.0030.04014.72
5.3.230.0000.04014.65
5.3.220.0070.03314.64
5.3.210.0030.03714.68
5.3.200.0070.05014.64
5.3.190.0030.06314.71
5.3.180.0000.05314.63
5.3.170.0070.04714.61
5.3.160.0130.04014.55
5.3.150.0070.04014.68
5.3.140.0170.02314.54
5.3.130.0030.04014.67
5.3.120.0100.05714.61
5.3.110.0030.06314.55
5.3.100.0100.05014.14
5.3.90.0070.03314.00
5.3.80.0070.03014.06
5.3.70.0030.03714.14
5.3.60.0100.02713.99
5.3.50.0030.03713.93
5.3.40.0000.04013.93
5.3.30.0030.03314.08
5.3.20.0070.03713.86
5.3.10.0000.03713.64
5.3.00.0030.04013.58
5.2.170.0030.02711.31
5.2.160.0030.02711.12
5.2.150.0030.02711.23
5.2.140.0000.03011.21
5.2.130.0000.03011.17
5.2.120.0030.02711.28
5.2.110.0000.05311.30
5.2.100.0070.02311.24
5.2.90.0030.02711.14
5.2.80.0030.02711.21
5.2.70.0000.03011.14
5.2.60.0030.03711.14
5.2.50.0030.02711.21
5.2.40.0070.03010.99
5.2.30.0030.03711.02
5.2.20.0030.03011.11
5.2.10.0030.02710.98
5.2.00.0030.02710.73
5.1.60.0000.02710.19
5.1.50.0000.0439.95
5.1.40.0070.02010.18
5.1.30.0030.02310.55
5.1.20.0000.02710.49
5.1.10.0000.03710.23
5.1.00.0030.02710.26
5.0.50.0000.0238.66
5.0.40.0070.0208.64
5.0.30.0000.0308.42
5.0.20.0000.0408.42
5.0.10.0030.0438.34
5.0.00.0070.0538.30
4.4.90.0030.0137.65
4.4.80.0000.0277.65
4.4.70.0000.0177.65
4.4.60.0030.0137.65
4.4.50.0030.0137.65
4.4.40.0000.0437.65
4.4.30.0000.0177.65
4.4.20.0030.0137.65
4.4.10.0000.0177.65
4.4.00.0030.0477.65
4.3.110.0000.0207.65
4.3.100.0000.0377.65
4.3.90.0030.0337.65
4.3.80.0000.0507.65
4.3.70.0030.0337.65
4.3.60.0030.0337.65
4.3.50.0000.0377.65
4.3.40.0030.0437.65
4.3.30.0000.0307.65
4.3.20.0070.0307.65
4.3.10.0030.0277.65
4.3.00.0000.0307.65

preferences:
44.19 ms | 401 KiB | 5 Q