PHP Use the list of words provided in “ input.txt ”. Then, iterate over each wor
ID: 3752381 • Letter: P
Question
PHP
Use the list of words provided in “input.txt”. Then, iterate over each word, and 10% of the time, change the current letter (we are adding typos to the words). You can use the rand(1,100) function. If it provides a value <= 10, mutate your letter. If it provides a value > 10, do not mutate. Print the list of words to an html table (sorted). Also, write these values to a file “misspelled.txt”. Use the format:
word1,word2,word3,word4,…,finalWord
input.txt
underachievers,oscilloscopes,impales,overdriven,reconvicts,bernadette,dislocate,predecessors,hater,recoilless,nominis,pedantry,phosphate,nubs,dainty,volunteer,equality,ludo,sorbet,quinsy,quiescence,osiers,semanticist,sermonized,permittee,dustier,desalinises,excludable,impales,subtractions,dervish,juggle,hater,cosmologist,temporally,emoluments,astounding,gabbiness,rhapsodizing,grads,indigos,autocrosses,myofibril,longshoreman,cosmologist,incorporator,rexene,shojis,bank,nubs,uppingham,pigeonholing,gyroscopic,clansman,humeri,batavia,proposition,fovea,disrupts,stannic,acquiescent,alive,medlars,crouched,peerlessly,talons,fluke,versailles,fearfully,geodesics,fisher,briskest,toys,rustics,centilitres,scorpions,blake,predecessors,truncates,thanklessly,fovea,harassers,spherically,xylophones,unitarianism,debriefs,flared,delores,chairmen,squibs,ikon,fearfully,festering,scorpions,subprograms,antiparticles,dyslectics,lourdes,kinsfolk,theorise,forefront,subtractions,resurrect,vitro,ticked,denis,intestines,fosterage,nebbish,misjudgements,brittle,hula,excludable,ridded,diffusive,pedantries,modes,bernadette,aylesbury,sleighing,magnetrons,pylorus,fruit,ejaculations,stereoscope,gaolers,christianizes,clashes,purchasable,portioned,burgh,gabbiness,baronum,sorbet,connectors,boathouses,ludo,milford,cruciform,penetrates,plesiosaurs,digestibility,reset,outgrowth,cytologist,buddhists,cokes,osiers,shrewsbury,machinelike,newquay,meiotic,isobaric,plunges,officio,openness,kindergartener,weal,sniggers,diffusive,iconographic,petrii,testers,kitting,ashtray,incubators,sermonized,husbands,pinhole,oligopsonies,consolably,oversight,megaphone,graduating,infusion,snaffles,gabbiness,scooping,uppingham,tenant,rectal,joshed,hater,daystar,eschatological,forefront,illumines,insinuatingly,impolite,dispels,inkblot,residing,fags,rectal,bournemouth,stubbiness,riskier,rumanians,megalomaniacs,inspirations,burgh,overpowers,seashore,xiv,wroth,kilocycle,palindromic,ohms,paralytic,coulombs,snitches,illumines,riyadh,subsiding,forcemeat,lousy,outlasting,compulsive,fodder,saucers,burgh,kits,hairs
Explanation / Answer
<?php
$file1=fopen("input.txt","w");//Open the file into write mode
$file2=fopen("misspeled.txt","w");
fwrite($file1,"this is roseindia",30);
echo copy("input.txt","missspled.txt");//Copy the content of aa.txt into bb.txt
echo"<br>";
echo fread($file2,30);//Display the content of bb.txt
?>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.