<?php
$str = "23456789ABCDEGHJKMNPQRSTUVXYZabcdeghjkmnpqrstuvxyz";
$excludes = ['cp','cb','ck','c6','c9','rn','rm','mm','co','do','cl','db','qp','qb','dp','ww'];
$length = 5;
$indexedExcludes = array_combine($excludes, $excludes);
$dictionaryArray = str_split($str);
function fastCaptcha(array $dictionary, array $excludedSyllables, int $length): string
{
$captcha = '';
$previousCharacter = '';
$generatedLength = 0;
while ($generatedLength < $length) {
$randomCharacter = $dictionary[array_rand($dictionary)];
if(array_key_exists($previousCharacter . $randomCharacter, $excludedSyllables)) {
continue;
}
$captcha .= $randomCharacter;
$previousCharacter = $randomCharacter;
$generatedLength++;
}
return $captcha;
}
$excludesRegex = '/' . implode('|', $excludes) . '/';
function fuckedCaptcha(string $dictionary, string $excludedSyllables, int $length): string
{
do {
$code = substr(str_shuffle(str_repeat($dictionary, 3)), 0, $length);
} while (preg_match($excludedSyllables, $code));
return $code;
}
$t0 = microtime(true);
for ($i = 0; $i < 100000; $i++)
fuckedCaptcha($str, $excludesRegex, $length);
$t1 = microtime(true);
for ($i = 0; $i < 100000; $i++)
fastCaptcha($dictionaryArray, $indexedExcludes, $length);
$t2 = microtime(true);
echo "regexp : " . ($t1 - $t0) . "\n";
echo "array index: " . ($t2 - $t1) . "\n";
- Output for 8.3.2
- regexp : 0.24586606025696
array index: 0.068633079528809
- Output for 8.3.1
- regexp : 0.25802803039551
array index: 0.065507888793945
- Output for 8.3.0
- regexp : 0.25250005722046
array index: 0.064625024795532
- Output for 8.2.15
- regexp : 0.26526093482971
array index: 0.066206932067871
- Output for 8.2.14
- regexp : 0.24644804000854
array index: 0.064965963363647
- Output for 8.2.13
- regexp : 0.25864100456238
array index: 0.066395998001099
- Output for 8.2.12
- regexp : 0.28690981864929
array index: 0.071230173110962
- Output for 8.2.11
- regexp : 0.24837398529053
array index: 0.076382875442505
- Output for 8.2.10
- regexp : 0.23274612426758
array index: 0.089427947998047
- Output for 8.2.9
- regexp : 0.22945594787598
array index: 0.062534093856812
- Output for 8.2.8
- regexp : 0.22952604293823
array index: 0.066264867782593
- Output for 8.2.7
- regexp : 0.25709700584412
array index: 0.064085006713867
- Output for 8.2.6
- regexp : 0.28943490982056
array index: 0.068170070648193
- Output for 8.2.5
- regexp : 0.24534106254578
array index: 0.085160970687866
- Output for 8.2.4
- regexp : 0.28299689292908
array index: 0.066426992416382
- Output for 8.2.3
- regexp : 0.27357411384583
array index: 0.06793999671936
- Output for 8.2.2
- regexp : 0.24900698661804
array index: 0.083187103271484
- Output for 8.2.1
- regexp : 0.24372005462646
array index: 0.064696073532104
- Output for 8.2.0
- regexp : 0.25715899467468
array index: 0.066650867462158
- Output for 8.1.27
- regexp : 0.19020414352417
array index: 0.071584939956665
- Output for 8.1.26
- regexp : 0.1908130645752
array index: 0.061462879180908
- Output for 8.1.25
- regexp : 0.18802404403687
array index: 0.060844898223877
- Output for 8.1.24
- regexp : 0.20432090759277
array index: 0.062646150588989
- Output for 8.1.23
- regexp : 0.20940613746643
array index: 0.06147289276123
- Output for 8.1.22
- regexp : 0.32343792915344
array index: 0.063031196594238
- Output for 8.1.21
- regexp : 0.1858229637146
array index: 0.061191082000732
- Output for 8.1.20
- regexp : 0.2220139503479
array index: 0.060876131057739
- Output for 8.1.19
- regexp : 0.20227599143982
array index: 0.060001850128174
- Output for 8.1.18
- regexp : 0.20414185523987
array index: 0.060394048690796
- Output for 8.1.17
- regexp : 0.1972508430481
array index: 0.061463117599487
- Output for 8.1.16
- regexp : 0.20547604560852
array index: 0.061178922653198
- Output for 8.1.15
- regexp : 0.18742489814758
array index: 0.061831951141357
- Output for 8.1.14
- regexp : 0.20564603805542
array index: 0.062551021575928
- Output for 8.1.13
- regexp : 0.21428298950195
array index: 0.061377048492432
- Output for 8.1.12
- regexp : 0.19466304779053
array index: 0.0609450340271
- Output for 8.1.11
- regexp : 0.19925093650818
array index: 0.061052083969116
- Output for 8.1.10
- regexp : 0.18596291542053
array index: 0.060587882995605
- Output for 8.1.9
- regexp : 0.20986294746399
array index: 0.059570074081421
- Output for 8.1.8
- regexp : 0.18857192993164
array index: 0.060450077056885
- Output for 8.1.7
- regexp : 0.20271778106689
array index: 0.060047149658203
- Output for 8.1.6
- regexp : 0.2142608165741
array index: 0.060917139053345
- Output for 8.1.5
- regexp : 0.20277285575867
array index: 0.062173128128052
- Output for 8.1.4
- regexp : 0.20898699760437
array index: 0.061196088790894
- Output for 8.1.3
- regexp : 0.21581602096558
array index: 0.066522121429443
- Output for 8.1.2
- regexp : 0.20571494102478
array index: 0.066151142120361
- Output for 8.1.1
- regexp : 0.21315383911133
array index: 0.084407091140747
- Output for 8.1.0
- regexp : 0.2145779132843
array index: 0.071002006530762
- Output for 8.0.30
- regexp : 0.21440815925598
array index: 0.079880952835083
- Output for 8.0.29
- regexp : 0.20898699760437
array index: 0.068473100662231
- Output for 8.0.28
- regexp : 0.20600605010986
array index: 0.061590909957886
- Output for 8.0.27
- regexp : 0.19122385978699
array index: 0.071499109268188
- Output for 8.0.26
- regexp : 0.20440912246704
array index: 0.06114387512207
- Output for 8.0.25
- regexp : 0.18857884407043
array index: 0.060784101486206
- Output for 8.0.24
- regexp : 0.19007706642151
array index: 0.061077117919922
- Output for 8.0.23
- regexp : 0.20460104942322
array index: 0.06148099899292
- Output for 8.0.22
- regexp : 0.18811392784119
array index: 0.062270164489746
- Output for 8.0.21
- regexp : 0.19314908981323
array index: 0.064681053161621
- Output for 8.0.20
- regexp : 0.20634508132935
array index: 0.061422824859619
- Output for 8.0.19
- regexp : 0.18906283378601
array index: 0.061568021774292
- Output for 8.0.18
- regexp : 0.19859385490417
array index: 0.061464071273804
- Output for 8.0.17
- regexp : 0.18818497657776
array index: 0.060517072677612
- Output for 8.0.16
- regexp : 0.21347498893738
array index: 0.062808036804199
- Output for 8.0.15
- regexp : 0.2175178527832
array index: 0.068528175354004
- Output for 8.0.14
- regexp : 0.19741010665894
array index: 0.061758995056152
- Output for 8.0.13
- regexp : 0.229327917099
array index: 0.061099052429199
- Output for 8.0.12
- regexp : 0.19025897979736
array index: 0.063493967056274
- Output for 8.0.11
- regexp : 0.19088006019592
array index: 0.060424089431763
- Output for 8.0.10
- regexp : 0.19746899604797
array index: 0.062047004699707
- Output for 8.0.9
- regexp : 0.19834899902344
array index: 0.062745094299316
- Output for 8.0.8
- regexp : 0.20206308364868
array index: 0.060205936431885
- Output for 8.0.7
- regexp : 0.18837714195251
array index: 0.060470819473267
- Output for 8.0.6
- regexp : 0.20292186737061
array index: 0.063102006912231
- Output for 8.0.5
- regexp : 0.19714283943176
array index: 0.061178207397461
- Output for 8.0.3
- regexp : 0.21086812019348
array index: 0.061121940612793
- Output for 8.0.2
- regexp : 0.21346497535706
array index: 0.071563959121704
- Output for 8.0.1
- regexp : 0.19093489646912
array index: 0.06000804901123
- Output for 8.0.0
- regexp : 0.19190692901611
array index: 0.073570966720581
- Output for 7.4.33
- regexp : 0.18230414390564
array index: 0.064568042755127
- Output for 7.4.32
- regexp : 0.20317602157593
array index: 0.063773155212402
- Output for 7.4.30
- regexp : 0.19632291793823
array index: 0.065102100372314
- Output for 7.4.29
- regexp : 0.18913984298706
array index: 0.065309047698975
- Output for 7.4.28
- regexp : 0.18317198753357
array index: 0.065403938293457
- Output for 7.4.27
- regexp : 0.1900041103363
array index: 0.062533855438232
- Output for 7.4.26
- regexp : 0.18584704399109
array index: 0.064915895462036
- Output for 7.4.25
- regexp : 0.18342590332031
array index: 0.065757989883423
- Output for 7.4.24
- regexp : 0.19001293182373
array index: 0.06538200378418
- Output for 7.4.23
- regexp : 0.2074511051178
array index: 0.064388990402222
- Output for 7.4.22
- regexp : 0.18491578102112
array index: 0.063727140426636
- Output for 7.4.21
- regexp : 0.21033596992493
array index: 0.064656019210815
- Output for 7.4.20
- regexp : 0.19404006004333
array index: 0.063877820968628
- Output for 7.4.19
- regexp : 0.26515698432922
array index: 0.064352035522461
- Output for 7.4.18
- regexp : 0.18685698509216
array index: 0.065070867538452
- Output for 7.4.16
- regexp : 0.19887614250183
array index: 0.064635038375854
- Output for 7.4.15
- regexp : 0.20314288139343
array index: 0.065246105194092
- Output for 7.4.14
- regexp : 0.18946194648743
array index: 0.063261985778809
- Output for 7.4.13
- regexp : 0.30119109153748
array index: 0.063551902770996
- Output for 7.4.12
- regexp : 0.18157696723938
array index: 0.064727067947388
- Output for 7.4.11
- regexp : 0.21263289451599
array index: 0.068645000457764
- Output for 7.4.10
- regexp : 0.18896198272705
array index: 0.066162109375
- Output for 7.4.9
- regexp : 0.22148108482361
array index: 0.089463949203491
- Output for 7.4.8
- regexp : 0.18745303153992
array index: 0.063643932342529
- Output for 7.4.7
- regexp : 0.19572997093201
array index: 0.062916994094849
- Output for 7.4.6
- regexp : 0.20330309867859
array index: 0.064483880996704
- Output for 7.4.5
- regexp : 0.20575499534607
array index: 0.06371283531189
- Output for 7.4.4
- regexp : 0.20051884651184
array index: 0.083161115646362
- Output for 7.4.3
- regexp : 0.1902060508728
array index: 0.071161031723022
- Output for 7.4.2
- regexp : 0.19482207298279
array index: 0.067867040634155
- Output for 7.4.1
- regexp : 0.19041681289673
array index: 0.064472198486328
- Output for 7.4.0
- regexp : 0.1900520324707
array index: 0.065874099731445
- Output for 7.3.33
- regexp : 0.19181299209595
array index: 0.081772089004517
- Output for 7.3.32
- regexp : 0.19529318809509
array index: 0.072961807250977
- Output for 7.3.31
- regexp : 0.19914603233337
array index: 0.072476863861084
- Output for 7.3.30
- regexp : 0.20402002334595
array index: 0.092525959014893
- Output for 7.3.29
- regexp : 0.20283007621765
array index: 0.0729079246521
- Output for 7.3.28
- regexp : 0.18707990646362
array index: 0.073040008544922
- Output for 7.3.27
- regexp : 0.18467402458191
array index: 0.074851989746094
- Output for 7.3.26
- regexp : 0.18714690208435
array index: 0.074607133865356
- Output for 7.3.25
- regexp : 0.20458698272705
array index: 0.072525978088379
- Output for 7.3.24
- regexp : 0.20105481147766
array index: 0.08110499382019
- Output for 7.3.23
- regexp : 0.1885621547699
array index: 0.072597980499268
- Output for 7.3.22
- regexp : 0.18673300743103
array index: 0.074252843856812
- Output for 7.3.21
- regexp : 0.18641114234924
array index: 0.072041988372803
- Output for 7.3.20
- regexp : 0.20834493637085
array index: 0.076475143432617
- Output for 7.3.19
- regexp : 0.20178508758545
array index: 0.097691059112549
- Output for 7.3.18
- regexp : 0.19349408149719
array index: 0.073848962783813
- Output for 7.3.17
- regexp : 0.23007297515869
array index: 0.072185039520264
- Output for 7.3.16
- regexp : 0.19452309608459
array index: 0.073201894760132
- Output for 7.3.15
- regexp : 0.19382500648499
array index: 0.073032855987549
- Output for 7.3.14
- regexp : 0.21924018859863
array index: 0.072173833847046
- Output for 7.3.13
- regexp : 0.18696188926697
array index: 0.072678089141846
- Output for 7.3.12
- regexp : 0.19639301300049
array index: 0.093486785888672
- Output for 7.3.11
- regexp : 0.2176661491394
array index: 0.072928905487061
- Output for 7.3.10
- regexp : 0.18612194061279
array index: 0.073331117630005
- Output for 7.3.9
- regexp : 0.20237278938293
array index: 0.073156118392944
- Output for 7.3.8
- regexp : 0.20638108253479
array index: 0.074267148971558
- Output for 7.3.7
- regexp : 0.20073890686035
array index: 0.075347185134888
- Output for 7.3.6
- regexp : 0.18843507766724
array index: 0.072544097900391
- Output for 7.3.5
- regexp : 0.21206307411194
array index: 0.073430061340332
- Output for 7.3.4
- regexp : 0.18497014045715
array index: 0.073920011520386
- Output for 7.3.3
- regexp : 0.19910097122192
array index: 0.071786880493164
- Output for 7.3.2
- regexp : 0.30365300178528
array index: 0.074851036071777
- Output for 7.3.1
- regexp : 0.1941339969635
array index: 0.072424173355103
- Output for 7.3.0
- regexp : 0.20970797538757
array index: 0.073312044143677
- Output for 7.2.34
- regexp : 0.30031704902649
array index: 0.077761888504028
- Output for 7.2.33
- regexp : 0.27792406082153
array index: 0.077379941940308
- Output for 7.2.32
- regexp : 0.2732298374176
array index: 0.089884042739868
- Output for 7.2.31
- regexp : 0.28148412704468
array index: 0.075553894042969
- Output for 7.2.30
- regexp : 0.29225707054138
array index: 0.075782060623169
- Output for 7.2.29
- regexp : 0.31440496444702
array index: 0.075584888458252
- Output for 7.2.28
- regexp : 0.27536106109619
array index: 0.075782060623169
- Output for 7.2.27
- regexp : 0.29987192153931
array index: 0.077622175216675
- Output for 7.2.26
- regexp : 0.28757309913635
array index: 0.076666831970215
- Output for 7.2.25
- regexp : 0.27413010597229
array index: 0.078589916229248
- Output for 7.2.24
- regexp : 0.28757691383362
array index: 0.076957225799561
- Output for 7.2.23
- regexp : 0.27363300323486
array index: 0.07737398147583
- Output for 7.2.22
- regexp : 0.30955481529236
array index: 0.076303958892822
- Output for 7.2.21
- regexp : 0.2909529209137
array index: 0.076223134994507
- Output for 7.2.20
- regexp : 0.29168605804443
array index: 0.074990034103394
- Output for 7.2.19
- regexp : 0.27535915374756
array index: 0.081200838088989
- Output for 7.2.18
- regexp : 0.30036091804504
array index: 0.078800201416016
- Output for 7.2.17
- regexp : 0.29878807067871
array index: 0.076023817062378
- Output for 7.2.16
- regexp : 0.28298807144165
array index: 0.078008890151978
- Output for 7.2.15
- regexp : 0.31070780754089
array index: 0.077491998672485
- Output for 7.2.14
- regexp : 0.28801298141479
array index: 0.078711032867432
- Output for 7.2.13
- regexp : 0.3010790348053
array index: 0.094088792800903
- Output for 7.2.12
- regexp : 0.27952003479004
array index: 0.08203387260437
- Output for 7.2.11
- regexp : 0.29809403419495
array index: 0.07807183265686
- Output for 7.2.10
- regexp : 0.30075788497925
array index: 0.075695037841797
- Output for 7.2.9
- regexp : 0.28712892532349
array index: 0.076509952545166
- Output for 7.2.8
- regexp : 0.27960896492004
array index: 0.07799506187439
- Output for 7.2.7
- regexp : 0.27987504005432
array index: 0.076722145080566
- Output for 7.2.6
- regexp : 0.27514696121216
array index: 0.075834035873413
- Output for 7.2.5
- regexp : 0.30886602401733
array index: 0.077047824859619
- Output for 7.2.4
- regexp : 0.28097200393677
array index: 0.075706005096436
- Output for 7.2.3
- regexp : 0.27908205986023
array index: 0.079396963119507
- Output for 7.2.2
- regexp : 0.29615688323975
array index: 0.076834201812744
- Output for 7.2.1
- regexp : 0.27459001541138
array index: 0.077772855758667
- Output for 7.2.0
- regexp : 0.28091478347778
array index: 0.076908111572266
- Output for 7.1.33
- regexp : 0.33716297149658
array index: 0.10049605369568
- Output for 7.1.32
- regexp : 0.28596019744873
array index: 0.097855806350708
- Output for 7.1.31
- regexp : 0.2939281463623
array index: 0.10256290435791
- Output for 7.1.30
- regexp : 0.27684998512268
array index: 0.099771022796631
- Output for 7.1.29
- regexp : 0.2736599445343
array index: 0.099669933319092
- Output for 7.1.28
- regexp : 0.27290797233582
array index: 0.10072994232178
- Output for 7.1.27
- regexp : 0.27886891365051
array index: 0.10057997703552
- Output for 7.1.26
- regexp : 0.27332901954651
array index: 0.098757028579712
- Output for 7.1.25
- regexp : 0.27884602546692
array index: 0.10025787353516
- Output for 7.1.24
- regexp : 0.28851509094238
array index: 0.099456071853638
- Output for 7.1.23
- regexp : 0.28438997268677
array index: 0.099155187606812
- Output for 7.1.22
- regexp : 0.27729606628418
array index: 0.10138082504272
- Output for 7.1.21
- regexp : 0.29177308082581
array index: 0.10518097877502
- Output for 7.1.20
- regexp : 0.30542302131653
array index: 0.10280203819275
- Output for 7.1.19
- regexp : 0.27162909507751
array index: 0.099497079849243
- Output for 7.1.18
- regexp : 0.27273011207581
array index: 0.10006999969482
- Output for 7.1.17
- regexp : 0.27326893806458
array index: 0.10025095939636
- Output for 7.1.16
- regexp : 0.27278614044189
array index: 0.099543809890747
- Output for 7.1.15
- regexp : 0.27259492874146
array index: 0.098994016647339
- Output for 7.1.14
- regexp : 0.27169394493103
array index: 0.10004091262817
- Output for 7.1.13
- regexp : 0.28060483932495
array index: 0.10049200057983
- Output for 7.1.12
- regexp : 0.27149295806885
array index: 0.10060214996338
- Output for 7.1.11
- regexp : 0.27362084388733
array index: 0.10088706016541
- Output for 7.1.10
- regexp : 0.29946398735046
array index: 0.10133099555969
- Output for 7.1.9
- regexp : 0.28466701507568
array index: 0.099684000015259
- Output for 7.1.8
- regexp : 0.2717981338501
array index: 0.10302901268005
- Output for 7.1.7
- regexp : 0.28574395179749
array index: 0.1005871295929
- Output for 7.1.6
- regexp : 0.28869295120239
array index: 0.10428404808044
- Output for 7.1.5
- regexp : 0.28791999816895
array index: 0.1013970375061
- Output for 7.1.4
- regexp : 0.30618095397949
array index: 0.099865198135376
- Output for 7.1.3
- regexp : 0.30785894393921
array index: 0.099431037902832
- Output for 7.1.2
- regexp : 0.28223991394043
array index: 0.11045503616333
- Output for 7.1.1
- regexp : 0.28170299530029
array index: 0.1028790473938
- Output for 7.1.0
- regexp : 0.28800797462463
array index: 0.10028886795044
- Output for 7.0.33
- regexp : 0.24309086799622
array index: 0.24671006202698
- Output for 7.0.32
- regexp : 0.21602010726929
array index: 0.24880194664001
- Output for 7.0.31
- regexp : 0.21666502952576
array index: 0.2506890296936
- Output for 7.0.30
- regexp : 0.21771907806396
array index: 0.25320196151733
- Output for 7.0.29
- regexp : 0.22383713722229
array index: 0.26679706573486
- Output for 7.0.28
- regexp : 0.21613907814026
array index: 0.27625107765198
- Output for 7.0.27
- regexp : 0.23256301879883
array index: 0.25420999526978
- Output for 7.0.26
- regexp : 0.22639894485474
array index: 0.25405287742615
- Output for 7.0.25
- regexp : 0.22800707817078
array index: 0.26207804679871
- Output for 7.0.24
- regexp : 0.21613192558289
array index: 0.25194191932678
- Output for 7.0.23
- regexp : 0.21722984313965
array index: 0.25291013717651
- Output for 7.0.22
- regexp : 0.25579309463501
array index: 0.25047588348389
- Output for 7.0.21
- regexp : 0.22387290000916
array index: 0.25189900398254
- Output for 7.0.20
- regexp : 0.22354793548584
array index: 0.25345015525818
- Output for 7.0.19
- regexp : 0.21730899810791
array index: 0.25518608093262
- Output for 7.0.18
- regexp : 0.22797703742981
array index: 0.25354790687561
- Output for 7.0.17
- regexp : 0.21608090400696
array index: 0.25670099258423
- Output for 7.0.16
- regexp : 0.2179160118103
array index: 0.2444179058075
- Output for 7.0.15
- regexp : 0.2173330783844
array index: 0.25199890136719
- Output for 7.0.14
- regexp : 0.21938014030457
array index: 0.25511479377747
- Output for 7.0.13
- regexp : 0.22359204292297
array index: 0.25337910652161
- Output for 7.0.12
- regexp : 0.23608994483948
array index: 0.292720079422
- Output for 7.0.11
- regexp : 0.21692705154419
array index: 0.2542200088501
- Output for 7.0.10
- regexp : 0.21630311012268
array index: 0.2520489692688
- Output for 7.0.9
- regexp : 0.22069311141968
array index: 0.28309392929077
- Output for 7.0.8
- regexp : 0.22428894042969
array index: 0.24946999549866
- Output for 7.0.7
- regexp : 0.23036599159241
array index: 0.24454498291016
- Output for 7.0.6
- regexp : 0.21835589408875
array index: 0.25015497207642
- Output for 7.0.5
- regexp : 0.24569797515869
array index: 0.25397992134094
- Output for 7.0.4
- regexp : 0.2484188079834
array index: 0.26370620727539
- Output for 7.0.3
- regexp : 0.23056983947754
array index: 0.25044202804565
- Output for 7.0.2
- regexp : 0.23113107681274
array index: 0.25736498832703
- Output for 7.0.1
- regexp : 0.22413778305054
array index: 0.25335121154785
- Output for 7.0.0
- regexp : 0.21733689308167
array index: 0.25924110412598
- Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
- Parse error: syntax error, unexpected ':', expecting '{' in /in/GYbWC on line 10
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected '[' in /in/GYbWC on line 4
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected '[' in /in/GYbWC on line 4
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error in /in/GYbWC on line 4
Process exited with code 255.
preferences:
248.9 ms | 401 KiB | 460 Q