3v4l.org

run code in 500+ PHP versions simultaneously
<?php function pcre_stristr($raw,$str,$pos=false){ $r = ''; if($raw!='' && $str!=''){ $str = (string) $str; $tmp = preg_split('/'.preg_quote($str,'/').'/su',$raw,2,PREG_SPLIT_OFFSET_CAPTURE); if(count($tmp)==2){ if($pos){ $r = $tmp[0][0]; } else{ if($tmp[0][0]==''){ $r = $raw; } else{ $r = substr($raw,strlen($tmp[0][0])); } } } else{ $r = false; } } return $r; } $raw = '0123456789abcdefghijklmnopqrstuvwxyzÁáÀàÂâÄäÃãĄąÆæÇçÉéÈèÊêËëĘęÍíÎîÌìÏïĮįÑñÓóÒòÔôÖöÕõŒœŞşẞßÚúÙùÛûÜüŲųŸÿ0123456789abcdefghijklmnopqrstuvwxyzÁáÀàÂâÄäÃãĄąÆæÇçÉéÈèÊêËëĘęÍíÎîÌìÏïĮįÑñÓóÒòÔôÖöÕõŒœŞşẞßÚúÙùÛûÜüŲųŸÿ'; $len = mb_strlen($raw); $tmp = array(); for($i=0;$i<10000;$i++){ $start = $lenth = 0; $start = mt_rand(0,$len-1); $length = mt_rand(1,min($len-$start,10)); if($start+$length<=$len){ $tmp[] = mb_substr($raw,$start,$length); } } $tmp = array_slice(array_unique($tmp),0,1000); echo '-----compatibility test-----'.PHP_EOL; echo 'samples count: '.count($tmp).PHP_EOL; foreach($tmp as $str){ $chk = true; if($chk && mb_strstr($raw,$str)!=pcre_stristr($raw,$str)){ $chk = false; } if($chk && mb_strstr($raw,$str,true)!=pcre_stristr($raw,$str,true)){ $chk = false; } if(!$chk && $str!='ß'){ echo 'raw: '.$raw.PHP_EOL; echo 'str: '.$str.PHP_EOL.PHP_EOL; echo 'mb_stristr($raw,$str,false)'.PHP_EOL.mb_stristr($raw,$str,false).PHP_EOL.PHP_EOL; echo 'pcre_stristr($raw,$str,false)'.PHP_EOL.pcre_stristr($raw,$str,false).PHP_EOL.PHP_EOL; echo 'mb_stristr($raw,$str,true)'.PHP_EOL.mb_stristr($raw,$str,true).PHP_EOL.PHP_EOL; echo 'pcre_stristr($raw,$str,true)'.PHP_EOL.pcre_stristr($raw,$str,true).PHP_EOL.PHP_EOL; echo 'test failed'; exit(); } } echo 'test finished'.PHP_EOL.PHP_EOL; echo '-----runtime test-----'.PHP_EOL; echo 'mb_stristr() x1000'.PHP_EOL; $time = microtime(true); foreach($tmp as $str){ mb_strstr($raw,$str); } $timea = microtime(true)-$time; echo 'load in '.number_format($timea,5).'ms'.PHP_EOL.PHP_EOL; echo 'pcre_stristr() x1000'.PHP_EOL; $time = microtime(true); foreach($tmp as $str){ pcre_stristr($raw,$str); } $timeb = microtime(true)-$time; echo 'load in '.number_format($timeb,5).'ms'.PHP_EOL.PHP_EOL; echo 'time save '.number_format(100-100*($timeb/$timea),2).'%'; ?>

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.5.90.0070.01822.07
8.5.80.0080.01521.80
8.5.70.0050.01719.96
8.5.60.0060.01522.05
8.5.50.0060.01621.53
8.5.40.0060.01619.79
8.5.30.0090.01518.68
8.5.20.0050.01719.96
8.5.10.0110.01518.74
8.5.00.0030.01819.76
8.4.240.0080.01822.55
8.4.230.0080.01722.76
8.4.220.0090.01722.64
8.4.210.0090.01721.71
8.4.200.0100.01821.68
8.4.190.0060.02322.82
8.4.180.0200.02721.67
8.4.170.0100.01722.03
8.4.160.0090.01721.87
8.4.150.0120.02021.86
8.4.140.0130.01419.95
8.4.130.0110.02419.64
8.4.120.0100.01619.85
8.4.110.0110.01519.95
8.4.100.0110.01521.03
8.4.90.0080.02020.83
8.4.80.0110.02020.15
8.4.70.0120.02719.87
8.4.60.0130.01419.96
8.4.50.0090.02021.03
8.4.40.0100.01819.81
8.4.30.0140.03619.93
8.4.20.0080.02119.74
8.4.10.0100.01719.71
8.3.330.0040.02421.54
8.3.320.0150.01720.53
8.3.310.0090.01720.37
8.3.300.0100.01820.61
8.3.290.0140.01821.30
8.3.280.0110.01721.37
8.3.270.0070.01819.84
8.3.260.0080.01919.77
8.3.250.0090.01519.94
8.3.240.0070.01819.88
8.3.230.0080.01919.95
8.3.220.0070.01919.88
8.3.210.0120.01619.65
8.3.200.0090.01419.89
8.3.190.0090.01519.08
8.3.180.0100.01619.13
8.3.170.0100.01819.12
8.3.160.0080.02719.05
8.3.150.0080.01719.10
8.3.140.0090.01618.76
8.3.130.0080.02021.80
8.3.120.0040.02121.86
8.3.110.0070.01619.71
8.3.100.0100.01418.96
8.3.90.0080.02019.94
8.3.80.0090.01519.99
8.3.70.0130.01519.81
8.3.60.0090.01520.03
8.3.50.0130.02419.99
8.3.40.0080.02121.29
8.3.30.0070.01621.32
8.3.20.0060.01721.20
8.3.10.0060.02121.20
8.3.00.0080.02021.29
8.2.330.0070.02021.32
8.2.320.0080.01521.29
8.2.310.0050.01821.20
8.2.300.0140.01620.27
8.2.290.0110.01818.93
8.2.280.0110.01718.80
8.2.270.0150.01618.95
8.2.260.0150.01518.99
8.2.250.0140.02018.64
8.2.240.0180.01818.80
8.2.230.0140.01518.59
8.2.220.0150.01818.79
8.2.210.0130.02318.95
8.2.200.0270.01819.76
8.2.190.0290.03518.91
8.2.180.0200.01618.67
8.2.170.0250.02520.20
8.2.160.0260.02220.53
8.2.150.0230.03221.14
8.2.140.0320.03920.13
8.2.130.0350.04220.05
8.2.120.0210.01820.29
8.2.110.0180.01620.34
8.2.100.0300.02722.29
8.2.90.0170.01420.29
8.2.80.0180.02823.25
8.2.70.0150.02220.32
8.2.60.0120.01221.31
8.2.50.0140.01520.92
8.2.40.0110.02120.30
8.2.30.0110.01820.02
8.2.20.0120.02020.21
8.2.10.0210.02120.16
8.2.00.0180.01920.02
8.1.340.0150.02319.97
8.1.330.0140.01818.64
8.1.320.0120.02218.71
8.1.310.0120.01918.69
8.1.300.0120.01920.52
8.1.290.0140.01718.71
8.1.280.0150.01718.75
8.1.270.0160.02122.16
8.1.260.0160.01820.01
8.1.250.0120.01521.06
8.1.240.0090.01723.02
8.1.230.0050.02020.20
8.1.220.0090.01621.15
8.1.210.0080.01821.86
8.1.200.0060.01920.24
8.1.190.0130.01720.96
8.1.180.0100.01521.01
8.1.170.0070.01922.76
8.1.160.0060.01819.94
8.1.150.0070.02020.08
8.1.140.0070.01820.14
8.1.130.0100.01620.06
8.1.120.0160.02820.18
8.1.110.0060.02120.01
8.1.100.0100.01620.07
8.1.90.0170.01520.07
8.1.80.0100.01820.12
8.1.70.0120.01520.04
8.1.60.0100.01820.45
8.1.50.0120.01720.06
8.1.40.0120.01420.13
8.1.30.0110.02120.40
8.1.20.0080.01821.33
8.1.10.0090.01820.45
8.1.00.0090.01720.37
8.0.300.0160.01619.33
8.0.290.0090.02119.48
8.0.280.0090.01920.76
8.0.270.0120.03119.40
8.0.260.0120.01419.57
8.0.250.0120.01319.43
8.0.240.0090.01421.33
8.0.230.0060.01720.38
8.0.220.0080.01919.43
8.0.210.0190.01219.68
8.0.200.0150.01821.16
8.0.190.0200.01420.14
8.0.180.0200.02019.42
8.0.170.0140.02619.63
8.0.160.0210.01319.47
8.0.150.0150.02919.57
8.0.140.0080.01820.39
8.0.130.0160.02419.48
8.0.120.0060.01721.32
8.0.110.0160.01421.06
8.0.100.0080.01820.23
8.0.90.0080.02320.25
8.0.80.0110.01220.56
8.0.70.0090.01521.39
8.0.60.0040.01919.54
8.0.50.0160.02220.37
8.0.30.0080.01919.61
8.0.20.0060.01922.04
8.0.10.0160.02519.73
8.0.00.0060.01919.86
7.4.330.0090.01821.95
7.4.320.0100.01219.15
7.4.300.0080.01620.00
7.4.290.0070.02019.36
7.4.280.0060.01720.95
7.4.270.0050.01921.66
7.4.260.0070.01820.22
7.4.250.0090.01719.14
7.4.240.0070.01819.08
7.4.230.0070.01621.79
7.4.220.0060.02121.07
7.4.210.0090.01421.82
7.4.200.0060.01721.98
7.4.190.0060.01620.11
7.4.180.0060.01622.00
7.4.160.0070.01520.03
7.4.150.0060.01920.02
7.4.140.0040.01819.98
7.4.130.0050.01820.12
7.4.120.0050.01719.87
7.4.110.0100.01721.83
7.4.100.0070.01721.94
7.4.90.0050.01819.91
7.4.80.0050.01921.72
7.4.70.0070.01521.83
7.4.60.0060.01621.83
7.4.50.0070.01421.86
7.4.40.0070.01521.90
7.4.30.0050.01521.87
7.4.20.0040.02019.11
7.4.10.0070.01621.89
7.4.00.0040.03019.64
7.3.330.0060.01621.90
7.3.320.0090.01221.90
7.3.310.0060.01621.90
7.3.300.0060.01621.90
7.3.290.0030.01821.90
7.3.280.0060.01620.16
7.3.270.0050.01721.99
7.3.260.0080.01421.96
7.3.250.0100.01420.18
7.3.240.0070.01520.23
7.3.230.0070.01620.27
7.3.220.0060.01920.14
7.3.210.0080.01521.89
7.3.200.0080.01519.10
7.3.190.0090.02221.02
7.3.180.0060.01721.02
7.3.170.0060.02021.05
7.3.160.0050.02220.97
7.3.150.0080.01819.28
7.3.140.0110.01420.68
7.3.130.0090.01620.97
7.3.120.0090.03118.26
7.3.110.0080.03418.59
7.3.100.0100.02118.53
7.3.90.0070.02718.44
7.3.80.0120.02618.97
7.3.70.0050.02718.85
7.3.60.0100.02618.74
7.3.50.0050.03018.43
7.3.40.0080.02618.38
7.3.30.0050.03418.29
7.3.20.0070.02221.10
7.3.10.0070.02520.74
7.3.00.0100.02720.86
7.2.340.0070.01920.34
7.2.330.0120.02320.40
7.2.320.0140.02219.47
7.2.310.0080.02219.43
7.2.300.0040.02319.24
7.2.290.0120.02120.41
7.2.280.0050.02322.04
7.2.270.0070.02020.39
7.2.260.0090.01821.99
7.2.250.0100.03719.75
7.2.240.0070.03819.89
7.2.230.0060.02919.80
7.2.220.0030.03719.89
7.2.210.0080.03019.84
7.2.200.0050.02818.77
7.2.190.0080.02818.92
7.2.180.0080.02618.98
7.2.170.0060.02919.03
7.2.160.0080.02122.26
7.2.150.0060.02022.19
7.2.140.0030.02322.25
7.2.130.0040.02322.16
7.2.120.0100.01622.25
7.2.110.0080.02022.05
7.2.100.0070.02022.19
7.2.90.0070.02222.28
7.2.80.0110.01722.29
7.2.70.0140.03022.20
7.2.60.0070.01922.27
7.2.50.0080.01822.13
7.2.40.0080.01622.29
7.2.30.0050.01922.29
7.2.20.0090.01922.20
7.2.10.0080.01922.17
7.2.00.0080.01822.23
7.1.330.0050.03520.22
7.1.320.0040.03320.28
7.1.310.0080.03420.18
7.1.300.0020.03520.21
7.1.290.0100.03020.12
7.1.280.0070.03320.06
7.1.270.0070.03220.08
7.1.260.0050.03320.10
7.1.250.0030.02420.97
7.1.240.0040.02421.00
7.1.230.0040.02521.12
7.1.220.0060.02120.78
7.1.210.0040.02321.07
7.1.200.0040.02421.09
7.1.190.0100.01821.03
7.1.180.0050.02420.87
7.1.170.0070.02120.99
7.1.160.0080.02321.01
7.1.150.0080.02021.01
7.1.140.0070.02120.96
7.1.130.0090.01920.96
7.1.120.0060.02221.13
7.1.110.0060.02421.12
7.1.100.0130.02221.04
7.1.90.0100.02021.20
7.1.80.0070.02321.14
7.1.70.0090.03620.71
7.1.60.0100.04020.95
7.1.50.0080.02921.04
7.1.40.0090.01921.07
7.1.30.0080.02121.17
7.1.20.0120.03021.12
7.1.10.0060.02221.25
7.1.00.0050.07323.46
7.0.330.0070.02020.89
7.0.320.0120.02020.91
7.0.310.0060.02420.70
7.0.300.0050.02820.62
7.0.290.0080.02320.66
7.0.280.0020.02820.92
7.0.270.0060.02620.81
7.0.260.0080.02120.72
7.0.250.0050.02420.90
7.0.240.0070.02321.08
7.0.230.0040.02420.95
7.0.220.0030.02720.93
7.0.210.0050.02220.78
7.0.200.0110.03119.50
7.0.190.0050.02520.82
7.0.180.0080.02220.84
7.0.170.0070.02221.01
7.0.160.0050.02620.71
7.0.150.0050.02220.89
7.0.140.0070.02120.93
7.0.130.0060.02520.77
7.0.120.0070.02120.80
7.0.110.0070.02120.74
7.0.100.0060.02420.68
7.0.90.0070.02420.83
7.0.80.0050.02420.50
7.0.70.0080.02120.57
7.0.60.0050.04721.85
7.0.50.0050.04620.74
7.0.40.0060.06621.07
7.0.30.0160.06020.95
7.0.20.0160.04320.97
7.0.10.0090.07021.02
7.0.00.0110.07121.02
5.6.400.0080.02518.97
5.6.390.0100.02619.11
5.6.380.0100.02519.01
5.6.370.0030.03019.06
5.6.360.0070.02919.06
5.6.350.0100.02318.91
5.6.340.0090.02518.93
5.6.330.0120.03719.22
5.6.320.0100.02518.97
5.6.310.0100.03019.00
5.6.300.0070.03218.80
5.6.290.0090.02718.88
5.6.280.0070.05621.50
5.6.270.0090.02419.02
5.6.260.0090.02419.13
5.6.250.0060.02719.07
5.6.240.0110.02519.00
5.6.230.0120.03018.95
5.6.220.0150.02719.21
5.6.210.0120.08421.16
5.6.200.0110.05119.97
5.6.190.0150.05421.10
5.6.180.0300.05621.15
5.6.170.0280.07521.30
5.6.160.0160.07021.11
5.6.150.0110.08020.14
5.6.140.0110.07620.04
5.6.130.0130.07519.99
5.6.120.0090.04921.61
5.6.110.0110.07721.50
5.6.100.0110.09021.59
5.6.90.0130.05221.48
5.6.80.0150.08021.06
5.6.70.0170.02718.94
5.6.60.0170.03118.92
5.6.50.0160.03218.90
5.6.40.0160.03219.08
5.6.30.0120.02619.21
5.6.20.0140.02919.09
5.6.10.0150.02919.27
5.6.00.0150.02918.83
5.5.380.0120.01319.15
5.5.370.0150.01918.87
5.5.360.0170.01818.84
5.5.350.2270.03421.14
5.5.340.0190.05019.77
5.5.330.0120.03420.80
5.5.320.0090.04020.85
5.5.310.0210.04520.94
5.5.300.0110.02819.84
5.5.290.0120.03219.85
5.5.280.0160.04621.16
5.5.270.0140.04921.26
5.5.260.0150.04921.31
5.5.250.0180.05421.20
5.5.240.0190.05120.99
5.5.230.0110.01519.12
5.5.220.0090.01718.94
5.5.210.0120.01319.25
5.5.200.0250.02618.79
5.5.190.0100.01518.97
5.5.180.0100.01418.93
5.5.170.0120.01318.63
5.5.160.0150.00918.78
5.5.150.0140.01118.79
5.5.140.0120.01118.81
5.5.130.0140.01018.88
5.5.120.0130.01118.75
5.5.110.0130.01118.75
5.5.100.0100.01519.07
5.5.90.0120.01018.91
5.5.80.0110.01118.90
5.5.70.0090.01819.04
5.5.60.0100.01319.13
5.5.50.0120.01619.19
5.5.40.0180.01219.06
5.5.30.0200.01718.90
5.5.20.0160.01919.12
5.5.10.0170.01519.00
5.5.00.0180.02119.18
5.4.450.0230.03319.03
5.4.440.0220.03119.08
5.4.430.0270.03418.99
5.4.420.0260.03719.05
5.4.410.0320.03418.93
5.4.400.0340.04519.01
5.4.390.0400.04918.76
5.4.380.0330.03918.83
5.4.370.0370.03218.75
5.4.360.0290.05218.94
5.4.350.0340.04318.95
5.4.340.0430.04418.88
5.4.330.0110.01216.00
5.4.320.0230.03118.93
5.4.310.0260.03518.92
5.4.300.0200.04518.80
5.4.290.0270.03718.85
5.4.280.0330.03818.69
5.4.270.0290.03718.82
5.4.260.0370.03418.81
5.4.250.0320.04718.74
5.4.240.0360.05018.81
5.4.230.0320.02718.85
5.4.220.0290.05018.70
5.4.210.0250.04318.74
5.4.200.0300.04418.75
5.4.190.0310.04618.74
5.4.180.0160.05318.66
5.4.170.0250.05018.79
5.4.160.0310.04718.77
5.4.150.0260.04118.80
5.4.140.0290.02817.40
5.4.130.0280.03617.63
5.4.120.0220.03317.69
5.4.110.0360.04517.69
5.4.100.0230.03117.62
5.4.90.0260.02717.49
5.4.80.0390.03017.74
5.4.70.0270.05117.62
5.4.60.0250.03717.59
5.4.50.0320.04817.60
5.4.40.0220.02917.60
5.4.30.0230.03217.64
5.4.20.0260.03017.47
5.4.10.0260.03017.54
5.4.00.0220.03017.20
5.3.290.0250.05316.81
5.3.280.0280.04316.66
5.3.270.0160.04416.67
5.3.260.0290.05516.90
5.3.250.0300.05316.85
5.3.240.0330.04816.53
5.3.230.0360.05816.82
5.3.220.0200.04416.67
5.3.210.0310.05116.66
5.3.200.0260.03916.60
5.3.190.0310.03916.63
5.3.180.0310.05616.89
5.3.170.0280.04716.81
5.3.160.0250.04016.64
5.3.150.0230.04816.90
5.3.140.0310.04716.78
5.3.130.0290.04516.63
5.3.120.0260.03416.79
5.3.110.0220.03116.68
5.3.100.0240.05016.55
5.3.90.0290.04216.54
5.3.80.0280.05316.37
5.3.70.0180.04016.43
5.3.60.0280.04916.53
5.3.50.0210.03916.32
5.3.40.0290.04716.51
5.3.30.0180.03716.26
5.3.20.0230.05016.22
5.3.10.0110.03016.16
5.3.00.0190.03116.14
5.2.170.0190.05114.57
5.2.160.0190.04314.48
5.2.150.0180.04114.53
5.2.140.0170.03414.46
5.2.130.0180.03414.46
5.2.120.0050.03214.60
5.2.110.0140.04414.46
5.2.100.0210.03014.48
5.2.90.0180.04214.45
5.2.80.0130.02814.43
5.2.70.0160.04014.52
5.2.60.0200.04114.46
5.2.50.0180.04214.49
5.2.40.0180.04514.54
5.2.30.0120.03214.48
5.2.20.0120.03314.38
5.2.10.0160.03014.33
5.2.00.0280.02414.29
5.1.60.0130.02614.40
5.1.50.0170.03914.44
5.1.40.0160.04514.48
5.1.30.0140.04714.66
5.1.20.0140.04314.59
5.1.10.0110.02814.60
5.1.00.0170.04514.48
5.0.50.0100.03113.77
5.0.40.0080.02913.73
5.0.30.0070.03613.73
5.0.20.0130.02713.73
5.0.10.0130.03713.73
5.0.00.0250.03013.73
4.4.90.0050.02713.73
4.4.80.0080.03313.73
4.4.70.0080.02413.73
4.4.60.0100.03013.73
4.4.50.0050.03613.73
4.4.40.0070.03613.73
4.4.30.0060.03313.73
4.4.20.0090.02813.73
4.4.10.0070.03113.73
4.4.00.0070.03713.73
4.3.110.0090.03513.73
4.3.100.0060.02713.73
4.3.90.0090.03413.73
4.3.80.0100.04813.73
4.3.70.0100.04013.73
4.3.60.0090.02713.73
4.3.50.0090.03213.73
4.3.40.0080.03213.73
4.3.30.0060.03113.73
4.3.20.0070.06813.73
4.3.10.0060.09413.73
4.3.00.0040.07713.73

preferences:
67.06 ms | 2996 KiB | 5 Q