Understandthatyoucanuse a simpletexteditor, too, right?
Scriptinglanguagecode, whetherit's PHP, whetherit's JavaScript, whetherit's Rubynow, themorecomplicated I D Ysdogiveyou a lotoffunctionalleyandmakeyourlife a hellof a loteasierwhenyou'rewritingcode, that's hundredsorthousandsoflines.
Butwhenyou'resimplytryingtostartoutandlearnhowtodobasicfunctions, learninghowtodobasicloops, thattypeofthingusingwhatevertexteditorisalreadyonyourcomputeris a greatwaytogo, soyoucanuse a basicAsk E texteditorinordertowriteyourcode, andyourcodewillfunctionjustthesameasifyouusesomethingalikeinnetbeans.
Solet's goovertomymaxso I cankindofshowyouhow a texteditorworks.
Andifyou'regoingtobewritingPHPcode.
SothisisjustmystandardMaccomputer.
Thisis a 2013 Macwiththeoperatingsystems.
Actually, lastgenerations I havetoupgradeit, butallwe'regoingtobedoinginordertowrite a littlebitlittlesnippetofPHPcodetodayiswe'regoingtobeusingtextatit.
So I'veputtextatitdownhereinmylittletaskbar.
Soit's easyformetouseingeneral, Butall I wouldhavetodois I gotofinder, I gotoapplicationsandthen I canscrolltofindtextatit.
Andyoucanseethattexteditorsrighthere.
Sonow I candoubleclickontext, edit, clickonnewdocument, andnow I canwritesomePHPcode.
Butbefore I writethePHPcode, I wanttosetupthistexteditorsenvironment s sothatitdoesn't doweirdthingstome.
It's important.
Understand?
Nowwhenyou'regoingtobeusingnote, padortextatitthatmanytimeswoulduse a texteditor.
Sowhatyou'regoingtodoisyou'regoingto d selectallofthistypeofstuffbecauseallyouwantisthatbasictexteditingyoucouldgotoopenandsaveoneofthingsyou'llseewithtextEditisithasonesaving a filead, not t X T extensionstoplaintextfiles.
Oneofthingsthatweregoingtodoiswe'regoingto d selectthisbecausewhenwesave a PHPfile, weneededtobesavedas a dotPHP.
SooneoftheissuesthatyougetintowithnewcoderswhattheydioisAh, somebodyThetexteditingsoftwarewilladddot t x t.
Andthereasonisisbecause a texteditorthenaddsdotTXteachingtheendsothatitsaysthenbasically, whatthefinalnameisisindexdotPHPdot t x t andassoonasyoudidatthead, thatdot t x t attheendthanthePHP.
Interpreterdoesn't knowwhattodowithit.
Sothenallwe'regonnadofromhereiswe'regonnaclose.
SoifthisisWindowsyou'd hit, applyandsave.
Andthenfromhere, we'lldonew.
Andnowwegetareprettyclean.
Nicelittleenvironment.
Sothis, yousee, there's nothere's norulers.
Thereisnonothingelse.
Andfromhere, wecanwritePHPcode.
Soif I wanttodo, let's say, ahbracket, I wanttosee, umquestionmarkPHP.
SothisopensupthePHPtagand I doprintdoAh, helloworldthen a closecolonandthen I close a PhD.
Sothisis a basicPHPscript.
I'm notgoingtoreallyexplainittoyouverymuchhere.
Basically, whatthisdoesisthisstartsthePHPscript.
Wethensayprintandthenwesay, Helloworldandattheendofeveryline, everycommandwedo a semicolonandthenweclosePHP.
Sothisis a fullfledgedPHPscripthere, evenifit's incrediblysimple, thenfromhere, allwedoiswegotofileandthenwe'regoingtogodowntosafe.
Andso a clickonsave.
Andnowit's veryimportantisyouseethatdot t x t there?
Wedon't wantdot t x t.
Wewanttomakesureit's alwaysdotPHP.
Soforthiswilldotest, let's saydotPHP.
Sothismeansthefile's nameistestandit's a PHPfile, andthenwell, thenwe'regoingtosaywherewewanttosaveit, too.
Soespecially, thisisonethingyouthinkaboutit.
Ifyou'regonnabeuploadingthisupto a sharedhostingserver, thenyouwon't putthefileinsomeplace.
Youknowwhereitis.
Basically a generalYouwanttoknowwe'regonnabesavingitto.
Soforme, I'lljustshovethisonthedesktoprightnow.
Makesmylifeeasier.
Ah, youleaveitasUnicode.
Ifnoextension, youknow, justjusttheselectthatdot t x t thing, andthenwe'regoingtoclicksafe.
Sofromthere, allwe d'ohaswecanminimizethisandwecanseerightherethatMacosrecognizesthisis a PHPscript.
Andthisisyourtestfile.
Andsofromhere, I cannowuploadthisupto a sharedhostingortomyserver, andthenthatPHPscriptwillrun.
Sothat's allyouneedto D'oh!
Ah, inordertobeabletorun, um, therebeaboverightPHPscriptsusing a texteditorsoyoucandothiswithnopad.
Youcoulddothiswithtextedit.
YoudothiswithnopadplusplusanyoftheaskingtexteditorsyoucanwritePHPcodeanditwillworkfinejustthesameasifyou'reusingfancy, youknow, I deeseorsuch.
Sothatansweriswhetherornotyoucanwrite a PHPcodewith a texteditor.
Um, fortherestofthistrackingeneral, I'llbeusing a basictexteditorjusttomakethingssimpleforyoutobeabletoseehowallthisoperatesandsothatyoureallyunderstandthatyoudon't need a complicatedideainordertowritePHP.