Whenyoucreateandset a variable, youdonothavetodeclarewhatthatvariableis.
Soinmanyprogramminglanguages, youhavetodeclarewhetherit's anend, whetherit's a char, whetherit's a string, whetherit's a bullwherethereis a floatandmanyotherdifferentdatatypesandPHPusedcansimplycreatethevariableandthensetittowhateveryouwantedtosetitthio.
Soifyouwanttoset a variabletobe a string, ifyouwanttoset a variabletobeafloat, ifyouwanttoset a variabletobeanindicator, youdon't havetodeclarethatbeforehand.
AndsotheissuewiththatisthatPHP.
Thenitdoesnotknowwhat a variableissupposedtobe, soitsimplyknowsthevariablename, anditknowswhatvalueyouhavesetthevariable, too, butitdoesn't knowifit's supposedtobe a wordifit's supposedtobe a string.
Whatyouwantisyouwantyourcodetoerrorout, soyouknowthere's a problemthere.
Youdon't wanttobeabletoadd a string.
Towaneditor.
Youdon't wanttobeabletoyoutrytotoaddanintegerand a stringtogetherandgetanoutputbecausethatwouldjustcomeoutasgarbage.
OneoftheissuesyouhaveinPHPisthatcanhappen.
Youcanaccidentallytrytoaddanintegerto a stringandthenifyou'reoutputtingthatintoyourdatabasethanthatinformationisgoingtodoyourdatabaseandthenthatisgoingtocorrupttheinformation, thedatabaseandbasicallymakeitworthless.
Sothat's whenthebigproblemsthatcodershavewithPHPisitsimplydoesn't everoutthewaythat a lotofotherprogramminglanguages D'oh.
Whichmeansyoucangetinthereandmakesit a lotfasterforyoutobe a bitcode.
A variableforstringofarableforendvariableforfloat.
Thestringishelloworld.
Theendissimplyoneandthefloatis 2.2 now, as I talkedaboutbefore, oneofthingstorememberwithvariablesandPHPisthatcapitalizationmatterssolowercasefloatisdifferent.
Itisliterallydifferentthanuppercasefloat.
Soifyouhaduppercase f lowercase L o A T, thatwouldbedifferentthaneitherofthesetwo.
Ifyouhadlowercase f l o A.
Andthathaduppercase T, thatwouldbedifferent.
Soremember, capitalizationmatters.
Sowe'regoingtodohereiswe'regoingtocreate a variablesodollarsignandwe'regoingtocreate a variablecalledgarbagepercent.
Sowe'regoingtobeusingthisas a garbagevariable, andthenwe'regoingtomakeitequaltoifweadddollarsignuppercasefloatplusinteger, Sowe'regoingtokeeptheend.
Soentlooksexactlyliketheendvariable.
Andsobasicallywhatwe'regoingtobedoingiswe'regoingtobeaddingtheendthevalueof N cetofloatalluppercase.
A lotofprogramminglanguage, Chrisitwouldeveroutiswe'regoingtocreateanothervariablecalledGarbagetoo, andsogarbagetowe'regoingtomakethatequaltostringplusend.
Andsoit's importanttounderstandthatifitdoesn't erroroutifyouactuallyget a value, andifyou'recreating a scriptthatdumpsthatvalueagainintosomethinglike a databasethatcancausesomeverybigissues, sohereagain, it's thesame, basicallythesamescriptwehadbeforetobeginwith, we'regoingtoprintweregoingtosaystringandtheyweregoingtoprintthevalueofstring.
Well, nowhejustgotzeroplus, whatevertheothervariableisthatgotdumpedintoyourdatabaseandsomebodyisgoingtohave a verybaddayinabout a monthwhenyoufigureoutallyournumbersarescrewedupdeadagainwiththestring, right?
Soinotherprogramminglanguages, ifyouadd a stringtoanend, thatshouldfail.
Thatshouldfail.
Buthereitworks.
sogarbagetoadding a stringagain.
Stringdoesn't haveanyvalueasasfarasbeing a number, soit's a swfarasbeing a mathematicalequation.
Stringdoesn't have a value, soyouessentiallyendupaddingzerotoend, whichisone.
Andsoifyou'redoinganykindofscriptthat's goingtobecollectinginformation, especiallycollecting a lotofinformation, thisiswhereyoucanruninto a lotofproblems.
Soyou'redoingthingssuchasgrabbing a wholebunchoftestscoresorsomethinglikethat, andthenyou'regoingtoAfricathemtogethertoseewhattheaverageoftheclassesifyoustartgetting a lotofonesand a lotofweirdnumbersinthere, thatcanreallycause a lotofproblems.
SothisisoneofthereasonswhycodersdislikePHPis, sinceyoudon't declarewhatthevariablesare, youcanendupgetting a lotofmesas.