0% found this document useful (0 votes)
2 views

PHP assignment 2

The document discusses various programming concepts in PHP, including string manipulation, arrays (both indexed and associative), and functions like word count. It provides examples of how to use these concepts effectively, such as splitting strings into arrays and counting words in a string. Additionally, it touches on image color allocation and sorting arrays of numbers.

Uploaded by

Abhishek Jadhav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
2 views

PHP assignment 2

The document discusses various programming concepts in PHP, including string manipulation, arrays (both indexed and associative), and functions like word count. It provides examples of how to use these concepts effectively, such as splitting strings into arrays and counting words in a string. Additionally, it touches on image color allocation and sorting arrays of numbers.

Uploaded by

Abhishek Jadhav
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
KASSignment Vo i- 2% | ferentiake D between. “im polde ond explode fueron. 7 F 4. : | mplede explode : coins array element|| Splits a String iqke ay inte a Single String Orray by breating [eames by _foserting a gule very. clurrence of String between thera. || de limeter —= = —— hb) ExpectS a gule Expects a delimiter anc! nd an arra string an input Stying i) Returns a Single Returns an array of Substys String that ig tne | Tetndeved A ray See) ety = An array uses numeric indice a C&tarting ~ Prom 0 )te store omd ace clemend — € ar ple 2? PHP $ Frurts sarvray CCapple” “Banana”, cherry) ) 4 eC Che $f iks To] Echo ebryia” - 2tho 4 Fruit fq 3 for each C4 Pris ag 4 Pruitt) x etre d fruts “
” » +F Assoctadive Array $ | =fAin astoc tative ray Stores ¢ lemer wa fe Cy—valve pairs where eacy leeg. w String (nStead “@ nomPrre ta dex a apa le 3 = 2 PHP stud en+ = Avrray~ CHamen 25% aR - “age” a> e © cours 6» 25” Computer? 2 che bStudent 2Cngme] j he Copy >?) che 4 tudent (Cages foreach Cbowent as peep > $ualve) eche ($ bey: $value cpr} 3 XS raalseate the use of str word count along with fts yin X ied Il 5 tr word — Count ©) ‘= Sez The tre Word = Count C) function i'n Php Q osed +o Couns tre Number at I soy oJ ty ao String I= D+ can a\So (dure AW _ ar rey ot words or an oagcociahve orray ~ wrth | word postions —Syntoazl= LIT Lr word COUN t CSP ny $Striing, tn § Format = 2 brtay Achar =)! m1 Xc! LPM : . ~ Panda. “Wwelle , nouns Youd woah LOI NA Bis. GA Werth CoWns bth i, CMa 4 Cau. fe clap 1h. program Ao crease PULP in. pap . cequine, OF oF On?’ )y PDL. pba 4 pot oe. bol O34, 4 go a) fila loge é — Seddon na ct “cia, 1)3 4 CALC feo Dy loy ‘Mes ly yA Sod 5 P06 nalath cading USI NY. PIAL JIS 4 $ID, ongiphe ID FL) L101 CLS. Dow showy Barat LNI8 Sn Ane Lao LEY AO leads e Uii Ate, g AGING. batting inhodt. Path) | oO Pench 15 ob tn Bicade 4 Ae Pht Propo. 4 5 POLS fe meet Se = de hoe ipod Cadkiena\) CéSS9 O00. os Se os a. 7: bel@s in modelo rizing Code t Venosanuke, and. nein Puoyrara yore ergaise ry pee. ok loo cd tax ‘ \ V5 br 4 akin iu ridleld Hi) AO% Oy Wb O45 fury i Cid Bi itt tn fonet OL State user Pehined Punchion and Crplaciy it ustan. ecample Z| = A Bobene, fonckvons= ime PRS tard fy {Bla tc. fpf et OV0.. 2. A COD PLAYS NDE CAL “ 3 DY) mn Of © FINO Logg AIA. 5 ob oncMon ned pin C006 1eU6 6. ome) 7 WAY Cr OF GYAN AISS OL) 0 2 “| } Fam = By Made 7 | Suwcrton Ponctilan-nawe CA Parafmeteyi $ Pa rea ian dd p—2% ) i od CO retorn byaluey APE x am ple <9 PhP Funch'o yn greet C 4 hame eu on © pelts. Lane 7) 3 Che 9g reat Cmte”)? Ot putt. la Clo) Picce f PL f uo+ Sting fonc+oy, and explain teu I SACO Ne. in “plop — <1) Sex werd = Count) !— + = Count words sn a sh [| = Coonts the number of Ww : jr'D§ 1 -g <3 Pap of _Wor0S ately Sty Helo PHpwog? 2) _Ethe Stim Word. coun + CAS bh) ie | o2 se x) She lene) tH why ey _ Pre place. re & Mello po oa SiveuChSto-)y He 6 Wet no = Cyclo PPL”: Bs ny Si past ste, COMP FR D OM _o(CurrenCe of a Sect S$ tring oe placement Syeda 22 PILE , ¥ pSaoon cs helte een 5 yx He 12) Ul words ec It a t Cap trahine Ane First le ttee a OF each tin asterng 5 7 ; Zils ey a HP PKe fe l Eehe Vlwerld ¢Cheio world”) AF Mellel! oe l 2 _i 19) Sty tmp &) t= a L Tr 5 uSe be Compare to0Stn a = _< 3Php Ge | Cho Stremp CM avple’, “ banana); # > = M 29> - - i Qe | write Php Script to Sort omg Fie pombe “| tf —¥Siing Saray fuhetidy- - 2. - l“€ 3 PHO | oe 14 Bile - numbers «C (eS, 23 eg Ley S612, 2% Sort C4 File number) 5 Cho (Shorted Elle pombers:”” ): Print Ch hile -nompers )' orted Pile tvumber ! Cy so 234 Se 22,85 (020) ° Colos P\lo Wotth fe Syntax 2 2 Emaye color Pilec at'on }- Von eto: —The Smagecoloral locates function 16 Used | to allocate a Color to adn imag Teseyre, Lip pips GP Liprary Aonce O Color 5 allocated, + can be Use) for vertovs mage Sperattons Sucis os draws’, | hapes , Whes dy» text or Cuey filine on | image with color aThe fenc+y takes tne red Green and hl | value: of Color Cinthe yange of 6 to xO) And _aleates that Coley to the Image +esSorte = Syntox- Image cole allocate ( resource Hee Gimase y int Fred , nt green Nyt bhlve ds Mat SS re CGrean ee HSE image Cate ©) Arto = Qed component Cod to 256) 9r€Cn'— Green Component Co +o > a iat Blu 2 rel CO a — Keturn vole v- — Re tu yn the aljocafed Cole sn dex gp BioSe on forlure

You might also like