Sothisis a goodwaytopulloutvalueswithin a textfile, especiallyifyou'redoingsomethinglike a listofnames, a listofnamesorlistofinventoryitemsthatsomethinglikethatyoucanhavethefilefunctionsscrollthrough, andwhatitwilldoisitwilltakeeverylineinthatfile, turnitinto a valueinanarray, andthenonceit's anarray, youcanthendoconditionaloffofthatarrayorworkwiththatarrayjustlike a normalarray, as I'veshowedyoubefore.
Soimaginethesenameshavebeenputinthefilefrom a formerforsomethingelse.
Maybeyoujusttypedoutthesenamesagain.
Onethingthat's reallynicewithPh.
B isdorealizeyoudon't havetocreatefullapplicationstodosomethingyoucouldsimplytypingnamesinto a textfileandthenfeedthattextfiletothepHBescript, whichessentiallyall I didhere.
Andsowhat I didis I putthenameBobononeline, Sueononelinemargin.
That's reallyallthereistobeabletoturn a fileintoanarrayandthenthatgivesyou a basicideahowyoucanstartdealingwiththearrayonceyou'vedonethat.
That's a basicoverviewofthefilefunctionforhowtoturn a fileintoanarray, anditkindofgivesyoutheideaofthedifferenttypesofthingsyoucandoonceyou'vedonethisagain, thingslikeinventoryitems, thingslikenamesofpeopleandattendinganevent, differentthingslikethatyou'reabletoputthatthatinformationinto a textfile, andthenyou'reabletoreadfromitagain.
Animportantthingtounderstand.
As a coder, especiallywhenyou'replayingaround, youdon't havetocreatecomplexinterfacesinordertodealwith.
Withscriptslikethisagain, youyoucanwritethenamesorwhateverelsedirectlyinto a textfileandthenbeabletoreadfromthetextfileagain.
It's just a simpledot T x t file.
There's nothingspecialtoit.
Soifyou'regonnabeaddingnamesorsomethingelse, youcouldjustsitthereandyoucantypeinyour 20 or 30 namesandthenhavethisscriptdealwithit, howeveryouwanttodealwithit.
Sothat's reallyallthereistothefilefunctionforturning a fileintoanarrayandPHP, andthat's whyitmatters.
Solet's talkaboutusingthefilefunctiontoturn a textfileintoanarrayinPHP.
Subtitles and vocabulary
Click the word to look it upClick the word to find further inforamtion about it