0% found this document useful (0 votes)
6 views23 pages

PHP Lab Assignment

The document contains various PHP programming tasks, including calculating odd and even sums, finding Armstrong numbers, and checking for palindromes. It also includes examples of using loops, functions, and handling arrays. Additionally, there are HTML form examples for student information input and quadratic equation solutions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
6 views23 pages

PHP Lab Assignment

The document contains various PHP programming tasks, including calculating odd and even sums, finding Armstrong numbers, and checking for palindromes. It also includes examples of using loops, functions, and handling arrays. Additionally, there are HTML form examples for student information input and quadratic equation solutions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
f Assignee) ee 5 urbe BEE OWna: iS bs Sa if ioe, mn ‘to find out #Re odd gum and even sum uning wile, a ZophP $num = =neadline (“Enten tRe rumben! “); Fiz 0} ; odd_sum = $[Link] = 05 wrile(gi <= $num) 7 Hi %2}=0)T fodd_sum += $3 Felse $[Link] += $1} Les « : ZeRo “InOdd sum (while): Fodd_sum In Eren sum (while) $even_sum's $}= gsum_odd = $sum_even = 05 | ete “In Odd sum Evensum using do-wRile loop!» | hay %2 = O)A Ssum_odd + = $43 | = | gsurn—even += 445 4 +5 le gy <= frum) 5 We “Yn Nas sum (do-w | $surm_even “5 *) ‘Quiput: [Enten te pumben 3 10 Odd sum and fyen sun wl 9 : | Odd sum euRite) & | | even ar afk): 30 | oda sum and Even sum wing dc-wRile. Loup 5 | Odd sum (do~ wile) ¢ 25~ | fyen sum @o- while); 30 | um tale a A program te paint n number ning foreacR loop uaing oxnoe. |) Source. code Output: - | | \ on “oho a nano 4, [e°y cents COCTEICTEIE] cabo tne | “~ preach ake co om Rilo): F5um_odd In Even sum (do— while); \3 eho UTS “5 —— 14 53 waite a pRp pn a PROGRAM +o UNE break Keyword in loop statement jy sounce code +— rfl =05 $1<=105 41 Output ! Pe Ro “gies Tt ttput ¢ FGreaics bneak; 4 SUS Cole aetna te we continua keyword In top statement. $i<=105 $144 Qutput — aa : | 0123468910 ecko Upi ts L 55 umite a pRp program to print your name uning fimetion. 2) Sounce Coca ps pad Fi Firbtion mame(){ ecko omy nomeis Riyo ‘Dey “ name()5 . int enteke tt - srytysn eager yr se le Gg os 5 Coda )- Pte icaafint, “vinat’, SHandiki/-RoRit “Row” patie = OU (Soe! gna) tor Se rena a@nieker Phoyens: “S Output: frengt Gro si TRe Tame oF Cricket Player: Sackin| yee Minot Handi, Rokit, Deni, aieketen orna(Sp-nawe) 3 Y St unite o. pRp program to une. tuo on more arguments wtf Phe fimetton F Sounce coda; - at gi Qutput t i ore, TRADE retin pager Sp Gacone-tn's Sackin pl onieket, 3 Ronatdo plays Footbat - Playen (YSacRin *, Yonicket") 5 ployer ("Renaldo “Foutbo'); yr A waite a mart orem nes out Re summotion of two [me fe menutt to Re cating’ fmation. se ” copkp | Fovcton sum ($x, $y) J | R= $x +43 ten $23 | S80 “TRe sum Of 20 and S4! “. sum (20,54) § | 9 } 2 0 : Te sum of 20 and SF: ment No- 6 ec. tonite oI PRP pewrarn seat a aoe a ' am elemant/elements to an existh PRS ‘am exi Ing array «| Fnames= aera Gana, "6 ine cme iC ean mmainysane. Univernity res ach GS rer in a Dat Spams “BCA & MGAY) acho b Tre. updated “ preach anes eee , ecRo"C8id “3 jated [Bund] [es = penta et en emer » @.3 unite a pRp program te sont string elem > Sounce colle I- e “a php Aue men = omnia Se f Rigo", Debemngema’, * SreRa’, “Mouerrita’ eR $e ecko “Re. eacK Ht emon on Si) ecko “L410 “5 ents im ancamding &.dancending oncton ie ee ‘sone, oe ‘maseending ondon ? Brad ones an $ i): a 4 eck 10 ass 5 eon year) $ ecko “gery Te Sorted are ‘mn denconding ondest eal BO narey, « an BNL ecko CFI Y |f } output uh — “he fot aw ay: Swox{}[Rys][Debam ry (SreRt Innit [Reta] Sai) jomted amd in aseending onder: era momenony [Snea| Tre Sonted omay indencending onder ; ma fareRa) TRiye) mourite) [Dy It 64 Ubtite a PP program Po sant Tumenie elements in ancending &idascending onder 5 hiss Un GA,210, th 35, 85); echo “TRe ‘echo U($i] “5 | Coch rum cn # i? | TUM) $ ecko ani Sonted aye m ancending ondon: "; wah ram wo 4 25 at Grud $ of Gruen a im deneonding onder; “5 tsa ¢ + “utp TRe Fant osu SJB i ding enctons 04)(35. 4 FRe sonted ara 17 oveencting moeo oe >] TRe sented avtiay im daneending ondors R185] ones 0) g Sige prep program to print names and tRein addnen using 2D arurary ae Foray ¢ (Suri Riya, sSevatt’,"Snaka"), on CPB", * Kolkata, magi) _pintintens Output :- fone . Asvx C [oe] = Su tT > Rye (q] =) Surat Tay > Sno. w > Ax fa ty 3 pe (g) =) toe; 5 fone 6.6 waite a phy nam to ‘print nuti-dimernionat . guts He mop ang pRp Fx = OUI s C12, 5) ) “saa wet Y print ($90) j iS 2) ) stor Sarre cre sree EerSrEtEE [et write a pRp program te delete alemeds uning unmet Sumetton =) Sowree corte }— pep gnum = aan (52, 24, 10, 48) 5 Ee : mre gh C arenas 43 Pree no on oe bos et Grum(i)); ecko “
TRe updated armas “3 ce (trum an fi DY ecko “THO * TRe fout ova: SYLAUATIT] Te updated ora § BIIAEeY Fsstgnment No- 4.1 unite a pRp prognam + . 2 source wae 8 SRotw tRe sum of digits of & number. gounee corte ;— Ss ieeat Output )— esen oe tailem mals (4 23 249 BI 3h 41 43 4% = 5 fer Gi= 25 $i <= $n5 $itt){ $isPninw = true; frUx=2s suxw da 0){ grnem = $num % 105 dnevormedNumben = (greveredNummben # LO) + frem 5 gnum = Cnt) (frum /10)5 if GoniginatNumben s= gnevernedNurmben) L ecko “ Goniginal Number 4a & Patindxome. Numben. “5 else 4 echo “gontginatNumben is nota Palindnorma Numben.“} » Jutput- [12321 is o Palindnome Numben. 5 Wnite o p&p program to neverng o TUMbeN+ ) Sounce & 1 ecko “Original Number: frum ebay ev =0) Pega sot trom =$rum % 10} gney = (nev # 10) + rem; $num = Cnt Chum /10)5 or eReyerned rumben: $ney “5 cal ” Output :— Oniginal Numhen ! 4321 Reyermed Numben : [2 34 = 5 Assignment NO-& ] Seale P program to “show= A Mumben ts a Pallndname on not Lphp. . nel isPatin gn} gonigmalNum = $13 gnetemedNum = 05 while ($m 20) Be = $n % 10 bon NevernedNum = (fnevewedNum #10) + i. gy = (mC $n /10)5 oe Yongrnasun =z $nevarmed Num) ack “goniginattum Js a Palindnome ruembore,"} “else ecko $oniginatvum is not a falindrome numbens um =neadline (Enter tRe mUomben; “)+ | ra (gre) 5 uti fenton Te numben : 122 » Output | it is a. Palndnome Tumse Ba Unite php progrem to, find out tRe oddsum and evernuan upto 2) Sounce Code} - Qutput +— fpr a 5 TRe onan (or deat) oddsum = $evensum = 05 s ’ 5 Ae Fee eee sey — LE Sesame a n (| (Si %2==0 HO ae heats else goddaum += $y bo uTRe Bensum of $nUM 5 $evernum In"5 ecRo'TRe Odisurn OF frum + $oddn umn “3 » bs unite a. php program te find out the nosis of#Ra. quadrats equation, F) Source Code 3— corre J $q =meadtine (Menten te 24); $b=neodline (ZEnten tRe your tbs $e =neadLine (“Enten tRe roUWe of e's %)5 Hoh D+ 4 ph Ket Me “=01N"s eo UTRe quadnatic equoston js “$a. HRooslate diseniminant- kd = ($b $5) — 4 * $A * HOF Sra + neal roots Srost Tht sqrt (¥d)) / (2 * $9)3 $noot $— sqrt ($d) / (2* PA); L QQ SEs TGS Ge Teal ad Ament atl Gnd Sy and di fr: { a felse if (4d==0) Uifenent? frovkt and fnoote"} | fire, neal Too = -$b/(2* 5 ecko “Route bie #8 a equal | $n0ot F else L | I Complex moots i} gnealPant = —$b /(2* $a) 5 Fimaginar fant = sqnt (Aba) /Q* $9; | f ecko “Y one complex: Smeal Paste + Fpimaginary ort yi and g$neatfont Fmaginory forty 5 | t | ” Enten the value of 'a°1Q Jutput ie Enten tRe yatuerdl- 'b' 1S Enten the value of ta" 3 TRe quodxatic equtstion is; 22+ 5K+3 =0 Roots) ate Twaland diffenent 3 -t omd ~1-5 3.4 nite a HTML code 4p cnoate afer with the following fields Student Coda, student Name; ten, ae eto -) Sounce. code} — E{DOCTYPE Ruy 2PM Lang = "En" dRead) emeta cRarmet ="UTF-8"> meta. nome ="Yiewpont® content = twtdth =de i HTML form ae Som aotion ="submit® meted = “post*> Stove fm =“gtd code > Student Code; dbr> dlobel fon= * std_mame"> Student Name! ZimpuFtype = “text! marne = Ustd mame) meta Ranet ="UTF-R> meta name =“viewpont* content= ited Usen form uyidtRederiee -widih, mitfal-seale =1,0> | bodily en action =“Ass1_4-pRp* mmetRod=4POST"> Label fon = “std_codte “> Student Code;
Student Name! J laber> inp type =stext Samer = “mary C77 | dlabel-fon ="dob") Date of Birth: Fate's name? glabel fon = ermamme) Metfien's NAM’ + KMabery dinpudtype = “text ™ nome = mame “Sd b01) Gemdan : din e="nadtiot name ="qendon" nu “ Sept aa ee ra O1eon dors Email Td: AB@ Id} Hobbien } Height! a yen ae uw mone = URatgds® > aubmit Fore cS Ass gud-pRps— Rin.) ore nop ecfo $POST L’sth conta") 2> eer re Capp ecko $_ POST] Amare] Dory Adanem 1
ABTA 1 <2php ecko _past [Maret d *] 77 Gante i <2 pRp eoRo $_ POST [Meante®] 2 > 4 Cabal forsee? Pro paring im oe pe =“ruxmber* name = wer min= 0" max = *{oO" neque cane “furne_eng Functional En UsR imp pe =Yrum ore nome = =tfene_eng min="0% Mars loo mequired 7= 60 && $pon tage £69) echo YC 5 else i Gpencentoge y= 50 && Fpeneentuge ¢=59) ecko YD“ 30 7 g/bo dys él > gnd_sem. Ril — Kr dread) Snd Sem ManksReet g > res 3nd Sem ManksReet Y/R2> Student Code! Student Name! Detabare Mamas + System + glabelS Communicative EngiisR Labs UT ob RKSHEET

You might also like