You are on page 1of 250
PHP, mie a weAlt shakeelS599@gmail.com Teale 0) acetate err ey PHP,MySQL Ln SRR Unt lil Ohad ASI By LPHP SL Ene tA 1 Sunt helalun IP UH UIL PHP Ct Lb BPE pobre SE Lid te SE ne iyo iat Ue SBEVL dr AHL Srvonte Jhb Me, tL Lael PSG TA Aus eh ti tee Ft Un eee ook te ni he AR UE eet SOILS Toe ib ARLE SAU UerStudent Li Subic tel L PCa lbw YG nti te rt E je PME tree Tux Professional Writer LiL LL bee rtid 7 LSU ABE th tue IS LAE TOL Tos Sal ean ntal ad ahaha & 2 A Beginners Sl Bue 2b te LAS PHP 22 Huw, Ure eo 6 not EF bute dadavascript HTML aS rFHTML So ThLet be hGHTML Sie Lbs BL ether CHU Thiet Liltebr bn UPL tel it le HTML ee ULL VE bi tL he AI Tee Part-1(Page:2) Cet) OT Bt A ate One ie tei fsFront PagaDreamweaverinc 27 UZ HTML ULE Th BO fore gl yee tb Pie LalBack End tie Thite ite TRAE Programs -> Apache Friends -> XAMPP Control Panel-ut¥ UUs 6 XAMPP 2 EA Gap Be ou SPUN ceca ie Pee & AMPP Control Panel Svc Apache sve MySql Sve FileZilla Mercury Install Directory: ¢:\xampp Status Check OR Busy..- Apache started [Port 80] Busy. MySql service stopped Busy... Apache stopped (Port 80) “ f& XAMPP Control Panel Modules Fisve Apache | Running (_ Stop Wisvc MySql |/Running Stop] MySql sexvice stopped Busy... Apache stopped (Port 80) Busy... Apache started (Port 80) Busy... MySql service started Sd Class rE) Saeed her Fe Glick Tool -> Glick Preference AL Arie A LU WIL Sus) PHP Designer el Preferences ‘BB General {i On Startup, cl Ga document Types id you know? {Ba Program Update gu cater RAMP and WAM are easy ways tointal the PHP, MySQL and Apache. Gl Syntax Highlighters baton apachefriends.or alenhcempp- windows hin) Code Explorer tp fon wartoser ver come {a Code Completions Ga code Te a Auto Coneletons Ga Auto Correctons (ere errr ste Settings (pho in) ici — exe (4) [Ccbcampplapachetbintphpind | (us) Example: C:\Program Files\xampp\php.exe: Example: C:\Program Files|xampp\php ini a Bomcers Inchde pkpin f you wan to debug MySQL Meg ations (a PHP Manual maths Gi Other Manuais Server paths Local server paths Ports Gl Web Search Intp: localhost [Cihxamophtdocs| Fles must be placed the hidas Folder inorder to use the localhost preview. UUW ECS XAMPPL, Def aut... Apply Cancel lew File PAFIGLIS PHP sk Apply > OK WL LA, 4 (Bj Document Types } a } HTML Micss Bermvavan - — Epwodusinm ~ — Guscaton ~ 7 O05, IM 401 Trend CSS 28 asoge = Tene 2 ccitlesWy Firat PHP Seript 4 efhead> 5 6 eboay> e <>php 1 // vhis script will print a Line on page B echo "Hello World! this is my first PHP script"; “ > 15 16 17 PHP Designer “out put-u2/Save < t£firs.phputc:\xamppihtdecs Sil 50 g-FEva(hitpillocainosutirst php) CPi erduai te aFieceh cM gohL Localhostyt bb Pec Tybrawser? Bes pte - em Birman - Eleirodainn ~ (7 pet intended Tego rigor | visor | r2po 12600 1 vapor Fagor | gor | 40 | S900 | SEO" veooe | veo 11700 1 | Hetlo World! this is my fest PHP script a a i vz Class-2(Page:8) er es!) ut AGO PHP Me Fut SI BHTML I, “PHP Welcome to IT Dunya "; _Gnzoutput a Welcome to IT Dunya it SLB sau Fed User tekE Wfogid ALi ge held SeusidL¥ PHP Tag (aylea PHP | Class-2(Page:9) Eres + Sai eo JiliwASP <%= "This is my first php script” %> | <% echo "This is my first php script"; %> + qetlted HTML, PHU php.ini -42Ce php.ini Pheer Ae TAREE ASP wt he sPHP FUL Solace Pe ef on off 9 SBC PHP ie Ue bn it Moy A ah Leino WiLL atti ne lA Lyf phpini os a dez uit php.ini LU Kampe TL AP \f exwindows/php.ini Kiev Pf PHP.#-Lils/.s) c:ixampplapachelbin/php.ini — Efervlers 2) ui(<2php 2> UF Py tuitceAte AL Geos rsaei tnd Bbw ot Ae shakeel599@gmail.com Class-3(Pag orn Sale lanl dared ig use yells g peed gS ternlegesd avg ust Ufo pole ev ad icy SOOPSSOOCeees esd hut Abe hp enh th ink af ec aereeel sie Gab REC te AUTRE Le Uns REE I eps eA we dnd O21 wf S Alfie Mb pALAEL 284 le aI SAGE See tee LPT PLANE) EO tnt ais // this is a comment: # this is another comment a DT EEE Le Soa A ti Puro i* this is a comment hone of this will be parsed by the PHP engine sf Bebra tn bo dphcnes Ga br tiatautl nee iH 6 EIA cof Variables SiAae Suse eS Sunt BA Boe Gi dat eds Fi it Zxdata container Gut 2 be Ae AU ey tal oe echo ( 5 + 2) Sifotairz AL Gednds 200 916 SLT Aare ee Se SIRE! et but eee SL echo ( 9 + 20) | echo ( 6 + 3) Class-3 (Page:2) Seer hbase Pues!) (6: Be TRL BAL| i aie ett Ae E user ut Untibtk ez Lit esp» Fetgumite pre x FEE Sali Ai) (Welcome Alito my site ) thi LT -S8y2478 Variables eereiz lb § Ke Ao Livariable- o ylTer th Variables (¢PHP eprtrt€ Variable oie PH s10-9)i7 (AZa-z)i7) pt8 Variable yt Pet PAL Prien in brte(Azaz yl (bint Amt! -urLkVariables — U8 Aan? sar $a_longigh variable name; $2453; $TT_Dunya; eh ASU Variables L121 OOK But LLL PHP I & 4 Variable Declaration Fut AGL wvariable —2-UtU'EUt te lend of statment r Gia We un ep tiFisiune LEE PEEL ome irk S assign ky Variable G*Urz= 5% Scountry = "Pakistan"; 2 Pakistan” assign xfs Muste_pt£(Scountry ) dkvariable HL US eft we SWGL "Pakistan < cScountry HF Statment GUL B yk woz aig WE Teeter S eit Siectin(nath) Anh eige Seria ge ody variable a tO! Ld of variable 1s! ut & Assignment Operater 1.6 ioe 6= Aut ire eT We bueg tL AU ==) AIP bt ala doe SLAG fide ofeae rire, anes GSUPHP Designer (I-60 Toff Te u7ut Lipp eof Equal uttghioue Class & (Page: chead>PHP Output: Sum is: 150 alGnumber_1 Lk variables vl BL Lary i the Serie ite Fut ~U2/ assign teks Fisie Ut £ Snumber_2 Snumbber_1 = 50; Snumber_2 = 100) "; Stest_var = 5; // integer echo "The data type of test_var variable is now:" . gettype( $test_var ); echo "
"; $test_var = "pakistan"; —// string echo "and now the data type is:" . gettype( $test_var ); echo "
"; Stest_var = 9.33; // double echo “data type is now:" . gettype( Stest_var ); echo "
"5 Stest_var = true; —// boolean echo "The data type of test_var variable is now:" . gettype( Stest_var ); echo "
"; > output: The data type of test_var variable is: NULL The data type of test_var variable is now: inte and now the data type is: string data type is now: double The data type of test_var variable is now: boolean LAs S variable ie o*9 gettype-\kwvariable YStest er AW ype king teu! £6LF-# datetype bi a SoP? gettypesiute assign (3678 variables tuxIGi_ ut eI Pee SF PHP vite 1S Assign i674 variables iSute ube Lute ey tie ubteceug hve hye th Sor LE ees trariables 6 We Abe hg ether A sotyper Ale tale thie? gottype "; settype ($myvar,"string") ; echo "The variable is now a:" . gettype (§myvar) ; > Output: Data type of myvar is: integer The variable is now a: string 2 Aig eftts-»-rvariable¥ integer type ti/2 "assign: 100M iti yre pt myvarfid & erg AST ane S sting PU beter h feu Vo settype Wort ise! settype (rtéUrys," ttsgdu) 6 AKL AL eke vaiable ie 6 Gy Ze SOLPHP Gb & A Se SiatCast uisettype yc den teutung hi Ge tee t Ke enh tthe. eth bese Fle LaGeee hey MCast Pag? tK3— Casting "; // 3.14 Sholder = ( string ) Sundecided; print gettype( $holder ); // string print "-- $holder
"; // 3.14 $holder = ( integer ) $undecided; print gettype( $holder ); // inte: print "-- Sholder
"; // 3 Sholder = ( double ) Sundecided; print gettype( $holder ); // double print " -- $holder
"; // 3.14 $holder = ( boolean ) $undecided; print gettype( $holder ); // boolean print " -- $holder
"; // 1 > il Cee er Fe Class-3(Pag es 4 Output: double string integer -- 3 double -- 3.14 boolean -- 1 3.14 14 EcastingA Ue shsfloating pointLsuilk Myc pt£ sundecided L futecKul LA A Sholder st kL sholder (Wwe ALA tisk Ufys Sundecided 243 Tbe Seg SAL AF sidoud let sundecided LY ty tz, Pai e bit thin Tie nteger|string Be Ge Korb SALEM hee Oe Teast Tbe Ui! «27 years ed U Pd usersinbotinteger AG tous” Butera Sage = (integer) Susex_age; print Sage; Output: 27 PAL Abeer ln intval (value) ;2t/ return, integer ie Wet doubleval (value) ;< t/ return, doubleslc Gxbyfi strval (value) ;2t/ return, stringnle Cbg Lu heute SnhL wl tts ey osteelsbeprint 1 echo LAG Ae Sti eRe lef! Ee ONES pA Sere UC iUtstringy 2% prtint Lecho GSE 4 Estring 22S escapesi ue 2 Se etd Oe Weep A tt 6 Let Class-3(Page:8) A I Love Pakistan" Gel escapes TEL utvyaid eet oy MIL Bet te de TN Aissrge 6 Sega Se AVEO LS IIL Lr fe print | echo Sey Sivet we Liege Seyret a a geity = “Islamabad” Output : City is: $city City is: Islamabad BEM Mode e Gre BWA tre Ft Le hE Unt Ln PhEet wie Seer BAA Se Eg PHP 24 bese AS PHP ot dU Bind PUL LAPHPIEL 4 AU Se Aen fb See BLE 8 AU inte UES 6 Ur Se WA LG eds 3C PHP Se ZEND 5A Sexi tal ¥EPHPUGT 8Uir wee ie 62 ey PHP Te Sate Se sred PHP ye 10 te De urhystiol PHP 9 Ue yb aoe boo shakeel599@gmail.com SOoeorseooos Class-4(Page:1) errr) Pee Sauls plu! eat L etree EIGEN SOOSOOSSOGSS (Operators jamal a Fg hs ES Pecan lisse get assigndol rete e koe Mac igihr Pac drag tr OGRE IA GSI L thn /aut L (symbols )etik 2! stu operandfic AY 5+10 ele L jeg ieee Gt S015 br Fy se LAK, oie gT+ ol operands «1015 Afi GEL PPL Lute bh itolnL operands The Assignment Operator = (=) bee tne a bry el cag ie hue $name = "shakeel" ; Arithmetic Operators gag 13 10 +3 @ + 3 10-7 ia » 5 lo/2 eo / 20 lo*2 we * 1 1033 up 8 LoL if operand’ SAE rte LEO Ae Lee tbe ctype 2 Se zoperand Class-4(Page: eas ma hear tL ea! Le Concatenation Operator = C.) treks ut tiralic nl oy Boy Ate tks "nelle" . “world” vib Ayzs"helloword’ S$centimeters = 200; print “the width is ". ($centimeters/100) . " meters"; Output : the width is 2 meters Combined Assignment Operators © Arithmetic iz 1 pw Fi Se LAL Act PHP whe assignment operator SLeweeA Jeune bly, UAL Concatenation Operator .s!Operators A uedypireidi Ltt Lie daz Soperand | Sty eee Wie Lipgitwel Altes: 1% SAGEM GS ne Sah operand te LES operand Sens amt tea ES") CombinedAssignment Operators eta Sy =Sy+5 Sy t= 5 + Sy =Sy-5 $y -= 5 -= Sy =Sy/5 Sy /= 5 f= Sy =Sy*5 Sy *= 5 te $y = $y %5 Sy = 5 Ss $y = $y . "test" $y .= "test" = ‘Comparison Operators = hs false | true F booleanute UG tule tire Le sn fik opevandse Wests (ated tine ge Jat (it, while) control structuresz-< Uyzs Lutte the sesx $x <5; ~£ fypitalseAin10 ted sx wid Syptrueyin 3 osx AL Comparison Operators (se a] 100 == 100 (Equivalence) x 20 (Greater than)< if lvl operandyl’t > true 5<10 (Less than)
    = 15 Lf vnciesstroperandl >= (Greater than or equal to) true 5 <= 15 ELionidnt operanduy < ess than or equal to) false 5 === "5" Ustsamal Data type Lives operands Us» = (identical) eet 2) eee mciea EL ES Le ALestring — Hes il—)equivalencestup a Je17-L double integer ols ja hy ut ert Logical Operators = (and, or, not) ~utd Ayptalse Ltrue xtsbooleanwic VLG IA Miz ci, ste tel Con) | (DU Ale ys trues brtme IF Bek eTe (OR) 11 (Sage == 27) || (Sage == 30) PIL eie271tsage Ace $3002 EP AGP Mort te bg be tere Av usitacrue Hur Aiezotsage Aulbeute rue ystdetrue Sypstalse AI T25 Usage Ale tetruew 92 butruey® Yor fT Lttruth table VoRALutuxFalse eel Gi LEOR | eperand-1 | parand-2 | Result true true true false true true true false true false false false hfe Teruety LtoRULevleteut falsed!y ¥ operands Kase hfe aba break Jee Jesor Cr SS Cele mctinet? Class-4(Page:5) ere) Pel (as) Uply-false deve tlyxs true gum true PU Us aie GIF lana ) 12 Ade Moin S21 AG ig SAE ABA te tp Sethi Joe thet (and) | bus (Sage == 27) && (Scountry == "pakistan"); we thle Jeas thi Pe typsraise JE nth yb eh e foie truth Wand Ai ypstalses Ale oly Bole Jeo ALi vie Bb le Se bE bnEiolik leUitLk table Sree G9 SAND (operand Operands? Raut true true true false true false true false false false false false Utuntleriitalsed!y,Laut trucoperands Uh Ute ube TU <= > Jel AND ELS ge Ce beh Class-4(Page:6) Crwnety arr eA ik Tot «(NOT :3 Octeo Er ee yp trveictalse vic typ false Frtruess/ sie AG I Increment, Decrement Operators = (+, --) 15 iat ni Loops nly le CFL So 1 ey integer typerie ty ULE KE BA ge merenenting sir JEL OK LG Ek Decrements(--)sl Increment operater #(++)utZ decrement ing (si sJb-ut! operator sass; Satt; ¢/ $a is incremented $a--;// $a is Decremented 2 Post Decrement Mut L6--sIPost Increment MEL b++01£ pel Sys p FAL-—S ere Increment GL 6a tl ey Ae LIE EWE ot e-utL Pre Decrement $a=5; +4$a; // $a is incremented ~-$a. // $a is Decremented Ue iga++ Sef Post Decrement{Post Increment iase GAY UtPrefixs Postfix! Be trdecrement {increment sAnle dxupueh f variable te Mult Ausle_te Decrement Increment kyssdé Ut++$a Se Pre Decrement \Pre Increment wot ea Li UTA the Jere Se tbh fisie deeipuks (Si Post Increment"; print "The value of test_var is:".$test_var."
    "; print "By using Post Increment the value of t print "
    "; print "On next line, the value is now: print "
    "; //using Post Decrement Stest_var = 5; Print "

    Post Decrement

    "; print "The value of test_var is:".$test_var."
    "; print "By using Post Decrement the value of test_var is: peint "“"; print "On next line, the value is now:".$test_var; peint "
    "; //using Pre Increment Stest_var = 5; ".+4$test_var; print "

    Pre Increment

    "; Print "The value of test_var is:".$test_var."
    "; print "By using Pre Increment the value of test_var is print "
    "; print "On next line, the value is now:".$test_var: peint "
    "; //using Pre Decrement Stest_var = 5; print "

    Pre Decrement

    " ; print "The value of test_var is:".$test_var."
    " Print "By using Pre Decrement the value of test_var is:".--$test_var; print "
    "; print "On next line, the value is now:".$test_var; print "
    "; 2 output: Post Increment The value of test var is:5 By using Post Increnent the value of test_var is:5 On next line, the value is now:6 Post Decrement The value of test var ist By using Post Decfenent the value of test_var on next line, the value is nowsd Pre Increment The value of test_var is:5 By using Pre Incranent the value of text_var Gn next line, the value is now6 Pre Decrement The value of test_var is:5 By using Pre decranent the value of text_var ‘the value is on next line, is:5 is:6 ist Class-4(Page: Geer machen EL altncrement = URAL Ati bya etest varfib Pe et aL gst increment twGids Sky utpost Increment Pe nlPre tnerement fue deg Sow 1M Asie Ger ho Aide b ne Betzee dnd Slaw 18 byazcil si tpecrement Constants = Kobi Pr yhut eda tert, Dei eiesutvariables FuZLe Hie PS eyconstant-uf Lb constant iutew al pnt e butane de Decrement PUL ee futmethod-Vaction|sl method LZ re klotHl pbb fi SESE SPRL EL eA faction te pile py get ihepostilyMie Ge method Met Ril Lilb usin Bn a6 Uy TL e page php tubules UTIL it UE Le ier le sally CEN bl iui toe tipurysiul bebe tl form tic: /xamp/htdocs US save pt myforn.php Uli c: /xamp/htdocs/forn LABS (myform. php)
    Please type your name: = (tL dataform.php MV bea Mi PFFIGL ILS save Hur SUL en LEU! UES saveut c:/xamp /ntdecs/ form Page:3) (dataform.php) eA Form Data Ut Ete BEALS save gC INL Sh http: //localhost/form/my£orm.php ETI LAE say Hello awiebteltrextbox elt CELT Le Lt enteral itp tag esiiuntal shakeel uttextbox 2AUBELG TG, Hello Shakeel se pet phy, UPS ek ebdataform.php fe get£ action wth vitid Ae yesmyzorm.php Ename ale Ae Pit pi SLU frost But e/ Ud cdataform.php t3 Ku CIB Ter En tLe act SOTA LIL HU Tap tk txttvame Mite afl Utdataform.php SMS let say Hello MimE br tspt title SF submit eq alle ky fie pt sname L Aol EY open G6 gGig KUAutdatatorm.pnp iS assioniLAMb sof txtnamecey! $Name = $ POST['txtName' ]; Se @arf he theta sis posrFssea Kits A geibAa sey ks @ Ma dS ele tebLmyform.php L Kaw textiame BI feud To yt ptt SF cextbox lultiellom ELF tbe utter AMee pile OY18_Post hehe Shorted giame o Class-6(Page:4) print "Hello ".$Name; Aculgérsubmitf dataform phppbit2 ltl submi tlh pth iteextbomieCat pln huge Arye bellow gl Modal cextbomsle uSeyis_Post PbPpLianO Reine yrtylee gi$ Postapre pt Leto iueterbin fi a AL eh tig rte nk $_GET = wocibetie Ly lhesCurr teen yquerystringuize oboe SE nésquerystringatudilyt http: //www.example .com/search.php?keyword=pakistan ahs File ptLkeywords [ub fouerystringfi#l- Luan Sut aude it Jet vie Sivturttig ln bspa? lL t£ Ge turtfiuerystringse pakistan Saburinfouerystrings http: //www.example.com/search.php?keyword-=pakistanscity=isb teizee SQuerystringscity Iyyuslkeywordfiutouerystringsptdeulet Ee Je s_cer FAL (Pod ouerystringfiple Go OCG sedirmre Lf ey Be ptCgettc: /xampp/ntdocs -U/ save apt£ link. phpta3£c: /xampp/ntdocs /gew! (1ink.php) USING GET</TI'TLE></HEAD> <BODY> <A href="get .php?site=ITDunya">Sending Querystring</A> </BODY></HTML> UMNILe: /xampp/htdocs/getal SY Boxe Xi tt SiGLvILS saves ey -W save epifget.php elereea st) A (get .php) <HTML> <HEAD><TITLE>Get Querystring Data al(http: // Loca lhost/get/link.php\ THI Ale UL Le BS savel foi eld Sh Sob ter Py AM, Sted Arte bile Lye U-Ahttp://localhost /get/get .php?site=ITDunyalelal he F ABU C11$_GET Utget. phpS*Sepu/stule 1TDunyarbse Querystingtisi tevtURL Fequerst ring dS QOBLIEL AirigetutmethodLl pipe beau Leta tL Lia ye oa uf s_camAe there ¥urn Switching Flow « emu UL Uiewis statement Febrero oie yt inet ficeSh Soi titer SLxtalsebt ruck ite nPwebicg Mit AGGitie wiuutrrieswrth te decisiontdte L Heist PBS gin hasnt AS inde te BES Af peace Sole Son eee YE ae iS nb tasw7/ Tae felons cee ELEN) be GIA SS ch leg ee ASU ce al Saad a ae ge ge te AS Sie ple sb 3 a dete Spl Sia sila TS My tle gd py Se OW My ed S15 apl RSLs gl pI Gaul gal v6 pp ATA asl 91 Goaly 287 CA be iba tlhe pobre AF Ld vaed tuber tas par Pl ot we Ep izg bet Fe wehgonet zi Jide det ruet i up condi tion I tie oft! it Ste ude Cis bce S bel (jue if (a condition is true) { execute a line of code; } Sprint! ne iieas? Foun th ity tL SAA SUNS pub Re LE Ent execute goto_otnersnop() Ute ASL buts nic SUB UL Se aE La Ae KE, LAL fed gect 9X = 27; $¥ = 30; if (8K < $Y) ( print "§X is less than $¥
    "; Af ($X > 8X) ( print "$¥ is greater than $Y
    " ; Af ($x == $y) { print "$X is equal to §¥
    "; if ($X <= $x) { print "$X is less than or equal to $Y
    " ; if ($X >= $Y) { print "$X is greater than or equal to $¥
    " ; af (9% 1= $x) { print "$X is not equal to $Y
    " ; ourPur: 27 is less than 30 27 is less than or equals to 30 27 is not equals to 30 hyp iL svaisx ted phe tec batruer Eco bE ites ib Supe Br Ben Ak Ais 30K tev aly 00 sx ses whe Ute icuigte Ar Uso Peo assign isyalsxcikye ho Jberi6’e lseUsif ALi tATLprexecute Meili Aiebrtalse@ porte Speyeh 1 LA Welse Celera (as1(-s)) Cee ben! if (expression) { Pyrexecute $54 5 le perue pty tS aS } else ¢ Crexecute Iu acases uw al , Ue Sabed Mlle tL password ke ie ue Agi isute. Se bese ss Labed dS spasswora We AG AUE LLL if Gets SiWersewdnfalseX IU i Gb Ade ibibo Scar relae ule Bpassword eh ELT eb, bneicome Lif 9E Sophy ge VM bec terror Lite brexecute ~BrexecuteShWelse) o/b kyspassword UkeWelse if Ain & pte UPI tl AG PUI SURE iii brtalseth tert it uo url AeriWelse if if ( expression ) ( LABELS trexecute IL bxtruevt AA ) else if ( another expression ) { LAMM ich d g Wikrencoute LF bt eB i wie bertalset WE iebngh ) else { Erenecute Byutcases~e Ghee em ee MLSS ith A sui SEs, c:/xampp/htdocs JAB ates ite Lub Serie li cvdd. per LICL the PUA BL IE ep SAL ~AS save apt quess.php tae shead> Guess a number Smumber) { echo "

    Your guess is too high

    "; echo ""; } else if (Suser_guess < $number) ( echo "

    Your guess is too low

    "; echo “
    The number is $number, you don't win, please play againshz>"; } else { echo "
    The number is $number, you win, please play againshr> "; ) ) >

    (idbnidden Look Sebnd vp e HK submit Ol ALA aiid atpAg Fisset fitout cull pre Aue ibe ne SU GHE assign Lieu ute brassion dln te Mog EH issete. Pietypstalsesstrue debs $site = "IT Dunya"; isset (Ssite) f/MSgpatrve = btsubmit Ose inde lp hOrll Ate eI PL AAG IL Cee Ee a ACrandomed iL brie Se LOW rand ( Ltn E Let Bolg eut Aut id sh S textboxL piitlerEsuser_quesscbe Mbp hur Litalyigefassing Gin bModre rand (1,10 Fuiichy fle pt£ $number Arete we ube De BARibis Kutt AGl suser_guesse3 Le Siegal whee Aer ned pole we Gi Gihinsie(e vecnd tel ysal if (Suser_guess > $number) { echo "

    Your guess is too high

    "; echo "
    The number is §number, you don't win, please play againchr>"; } DGS iS else it APL yntaisetecis Agee Welse is 64 ip Siege Aisle Uti bsteks else if ($user_guess < $number) { echo "

    Your guess is too low

    "; echo "
    The number is $number, you don't win, please play againchr>"; ) seep Se Wh Lbntalseg@ il i turd wi /be §le Sve lseut? ia! we EL ig IL bet Udita Ai Se Kt bE zaslely, else { echo "
    The number is $number, you win, please play again switch statment
    Please enter a number between 1 and 5

    Class-7(Page:3) Teer eas be Lpids IL br Guid le Metextbox fie pt Cnumberd & ee Py i Hi pig Suser_number -elneryi bE e Ue one trued ite Whiddenc pt£postfi wig th Bei fe switch Au cok ts S(numberdtextboxL put kak UL ALG AEL ibs at case case 1: echo "You Entered One"; break; CAL ELAS siz, 3, UALS Sh gnc Li efi tsmi tor LABE BLS Gutewiten@Ae yi detest suser_numbertte pi hr tye # BAUcAsecho "You Entered One") way liebe A Bteasedt ay te ey Wii ten Sat rues tL ABS 2,3,4,5 (Loops) = BEd ntalseltrueL HUG ne uyel, conditional statementi fey! statementl@iftie Gtr Gln dreruegt Mitty esse brut vlan Betti L nexecutes Acontentsyt wide AE conditional SLY Gun ep Ae Bef fia 000 6 Az 2h toe trexecuteltustl ed Atntrue Fora! do whilewhilewsud ee utpne-L uf Al* oop ~ While = feruesle VBS result Mit, Ke Dede ei tule Ke euhile loop et VOIL AxzLntalse while (a condition is true) ( Ceihe crue Uhh CEES To) erent ET er TNS Uliigtrexecutemiflinerucl A result! ile tug Aaa thte Upalte terete Uti break neil bus bcondi tion ft ateiuie RMU 2 A while Statement
    php $counter = 1; while ( $counter <= 9) { print $counter,"
    "; Scountert+; ) >
    Output: 1 2 3 4 5 6 7 8 9 LA GRA tuhile loops Gb Aliya teu! while ( $counter <= 9 ) eid tscountensbeun i OIL Hteddntbe 9 SoA Gi ey scounters® ect iit he Lerdl scounterag Oil Hide te 9.1 ffiet rete a1 BL bie 1 print $counter."
    "; $countert+; Ta ee MySQl GG Sn 2bS scounted s/w KU ef increment/ Scounter ili See rd t Rye lac Si Le Ai IIE bie tunika GI le true ke Us Wibrincrenenté kat scountenté bseiz2 albrexecutes WOE Meche the 9 FAK buP Loopmhebutal seus tunilenEemsye onl scounten sgh te pete tintin be EPO bt int ind edt Fy Lincrementy Scounter Hib increment A Ntle the ote ib tscountense-Gerutirboonaition EW ie OE aaa tocounterste dnt —do...while = Beda glcondi tion iti tee GA subi leniMigke CAS whi let gre etl Pl he yA ote tnexecute do { // code to be executed } while (expression) ; Susie Spe shine Lon Pt de sb LPI AZ be Tole br boanh ig bn = t&dowhile paputhtdocs fi bien tri slie dmhet ee ile brexecute tS save BE The do...while Statement
    \n"; Sum; } while ( $num > 200 && $num < 400 ); o>
    Ta ee MySQl —For «= sideclareh eyntell PSH AUS ile be einen Unie tb Uru & Sdecrementlincrement4U puttin 2 Age ie Eur / initialize decrementt increment s1L Set Lu phe cs Uryscounter faut vuniler > lp kedtor PEbetedinfinite JL J¥tl increment Bohr btuLS eth Ari Store bkercompact OA fiers Luli? for ( initialization expression; test expression; modification xpresion) { // code to be executed + LAU bel istor wee El Using the for Statement
    "; y >
    Litkopte de yentia Mite Bl iL peor Sekine? BP ecco id hy scountertdel pet S assionddMug z-Scountert#iZ/ decrement} increments yst2u tu! $countercerz J tS BAP teincrenent ys Atner SuiiLitecrich Gr Qt tikes day ~Ebwctalse@ ibe ide CR) tI (preak) Lac a Toba be Se AA eZ nexecute dem trie MR at whi levlfor boSPoreaks bi sul fd Lie Ble ost SIM ye LIL tESELS Cee ge itr FP aaa) a Using the break Statement
    "; , >
    Sitar se Le GAs pile tyr Verror IG pba Lh AA fob warning ht UL LAE GOASE Warning: Division by zero in D:\xampp\htdocs\loops.php on line 13 San00Putteyd stemp-be ol —4Filikys (scounterfistesforl Ate Spl Ose De Ate eye ei tite Aste Lathe full LY scounter CEA Ske lt torearino ih Ale AGS scounter dt eb PR Sue Sb EIS PLM file TU he swarningut papi Aezof 4000 On eA r Sst ulnteby see us0e ferrorbt aT Semel if skipscte ul continue Statement, 2" Bu . Bitin tA Myhe PULLS skips brevis uf continue statement Benen upgiijbae continue-Rethrend upgiiybhe break Sbod Tee UALS etd skiph edi MySql a Using the continue Statement
    "; ) >
    ES skip nseUrtcontinuer £ preanL Aut! ededidiur tees warning tf iitwud end upgslad® Ke se LAR dlc boxe scounter ui we LS skip#continue statmentzupe wxork Scounterzue tL y Forbes or Ulla the dll tscounter, Ue e th ff efor ths pointer Ste dba 10d $counter Nesting Loops = pote retbwen fLudynamic HTML tablese- gE Ari Persil etehie KAS savetthtdocse tL tables phot zi Stitle>Nesting Two for Loops
    "; fox ( Syl; Syel2; Syte ) ( print ""; for ( Sx=l; $x<=12; Sxt+ ) { print ""; print (Sx # $y): print ""; } print ""; » print ""; >
    FA hs Be thet ra Prowse S Rey < WI forwtiL oy ford AAI bY! ee pin RCE LL generate KL iP eee sl WL Le thcta> Bowl to tusen tao hob Lut ( Y 2) Pi ILS ec rth AL hb WELL a LL bg A) AoddSthe (evenah At AP ETI AL A reer ith A nee WAL LILO op agell (2) GTi be rine 20pbhe 2AM AE dayenL 2025p aby Lest tablesle fgef 100L york 2002 SethinteS displayEtievh, ub a020 shakeel599@gmail.com SIOSSISSIOS ISS em satel G5 ute WS GasgiT YS cabeuli yd Gas ss! UsSa dl «a gil ELE (String Functions) = LL byl e te byt Lie assion lle itor fer FP aa aes) tN WES pe SOUS AL Chega He te Behe lal to by lt iLike Ste uf stuayl 3ARF $str = “I Love Pakistan"; Pee A (ELIE Ore drassignt eA te obi tin fie tlestrh ea LF ihe - rtigstre Uta Atel teinoehien lind pone af te by P ria LE Aad get Bnreting hogs Er oak FRpuPit nodded 7a US Leu biowealutrh diene “U6 PHP Coreg Sree n SAME EEL Mi Ly ed chr 0 seth bettetbasciisyS chr (ascii value) We Stest = che (65); echo Stest: ve output: A ord @ -eyjubascii Mile WAAL el chry ord (character) Je Stest = ord("A"); echo $test: Yroutput: 65 ee me POLIS) trim © Beers ee Pps Flt pl Bo "" (ascrE 32 (0x20)), an ordinary space. "\t" (ASCII 9 (0x09)), a tab. "\n" (ASCIT 10 (0x0A)), (Line feed). "\e" (ASCIE 13 (Ox0D)), a carriage return. "\o" (ASCIZ 0 (0x00)), the NUL-byte. "\x0B" (ASCII 11 (0x0B)), a vertical tab. trim (string) Ue $etr = trim(" I Love Pakistan \n"); echo $str; wr output:I Love Pakistan eral ‘strien(string) Ue $country = "Pakistan"; echo ‘length of $country variable is:' . strlen (Scountry) ; se output: length of country variable is: @ ucfirst © -th bast (upper) 2 AB Lage ucfirst(string) ide "my name is shakeel"; getr = echo ucfirst($str) v© output: My name is shakeel CEES) Coren S ET eT TTS ucwords @ t (upper) VL BL fa Ue $str = "hello world"; $str2 = ucwords($str) = echo $str2; 4% output: Helio World strtoupper @ eth bit (upper caser brent Sat strtoupper(string) Je $str = “hello world"; $str2 = strtoupper($str) ; echo $str2; 3 output: HELLO WORLD strtolower © ~ethtrt (lower casei tf bry strtolower(string) se str = "HELLO WORLD"; $ete2 = strtolower($stz) ; echo $str2; Yr output: hello world Cee) rere Ta NS strstr © ae Ay PS AL PHL AL Lt GIL Mle MAL Lio rt strstr ( string haystack, string needle ) Je Sonaii = *usezGexample.con"; Sdonain = strotr(Gomaih,*@") ; echo $domain; sr output: @example.com substr © we thyp fey Lusky substr ( string string, int start [, int length] ) Ut echo substr(‘abedef', 1); J) bedet echo substr('abedef', 1, 3); // bed echo substr(‘abedef', 0, 4); // abcd echo substr('abedef', 0, 8); // abedef echo substr(‘abedef', -1, 1); // £ addslashes @ Zt fet databasefiAvalnln eC) GU CMA LE Seca lh LeriPWadaslashes hh Until rn Lite Nigh d ook pA te erro tole kM He Hu addslashes ( string str ) Ue $str = "Pakistan's"; echo addslashes ($str) ; % output: Pakistan\'s stripslashes @® OH a PEI PCREL A taddslasheslbl pe LY slashesdie Lr" aT Seema Ld OF ifutn in Koa database Seu tig UPA ble Lesh ole ts web hui nh eit ald Sai splay string stripslashes ( string str ) MySQ We $str = "Pakistan\'s"; echo stripslashes($str) ; vr output: Pakistan's htmlspecialchars © Soi Punt SOIL AL Le tL petnn entities SARL fs ch itive tpi fil fd Bye (comments) Ge rye te tL AG bebe c 210006 IL Met bY javascript ABEL ine pte LOE SS Ah Tal AEE STIL ibe wig ad UE be nt alert ped Fei bese ee Kare shone WLS hacking UE Yara SP Se taatabasehAsgat string htmispecialchars ( string string [, int quote _style [, string charset] ) Ue $str = "I am shakeel"; acho htmlspecialchars($str) ; ye string becomes: élt;hlégt;I am shakeelélt;hlsgt; we Result on Page: I am shakeel str_replace @® -ctAbye replacement string #1 ufsearch stringgauattoy” str_replace ( mixed search, mixed replace, mixed subject) ae $str = "Hello World!"; echo str_replace("World”, "Shakeel", $str) ; se output: Hello Shakeel! str_repeat e@ etl repeatiny str_repeat ( string input, int multiplier ) st echo str_repeat("*", 10); Sr output: tteeeeese nl2br © ne Pht bro Latta I nA LOS nl2br ( string string ) se echo nl2br("Errort :\n Cannot connect to database server."); ve output: Error! :
    Cannot connect to database server. md5 @ encrypt Bry Iuliy-e Woyfs ue txAnexadecimal 4S 32f2ma5 hasho fa” wet IAL SL md5( string ) se $str = “Hello”; echo md5($str) ; st output: 8b1a9953c4611296a827abf8c47804d7 LASe Antu tolep lef Lent A WEL Seed tes -ySend pnp neve 2G pL Ep 8 bt eA Ube I CT, Gere pea as Fans) Time|Date ua Perle teuig npg kV PnP Se PI Bute PEL time widate LPHP Ae! Puts Heuer Fo euPuleutnL ait /Motimessidate timesldate AFeonlinewthf Aine A WEIIA te Ary dele ixampe LAW Ber tL PEPY Le dthost et up nL yl “UL-O OPED Coreg date ASG Mert natestime 2d date @ wer PILE AP ecatestime Buri? string date ( string format [, int timestamp] ) J utparaneter £W(format weit Ute sdte L date ius? GAL RR Ute etl L \Podatetime Id 6 Ayub tt GbE Myst ( ve Je Khas #31fe01 Bon riontnonl ee d San = Mon pth bref Saturdaye Sunday pearl Zu | (Lee #12201 (teat Pure m Dec & Jan peek | M December< January cigs | 2008 | 1999 (eure a | ¥ 081 99 He pure 2 y PMLAM (tren ntirmamL ih | oA 12201 Gee duy Lal puree tec | oh 59201 Puri | i \ 59=01 ue pure | 8 em mace eaas UMAR) LE Lidatest ime Aba et We HLF cater echo date("¥"); //2008 (year) echo date("m"); //11 (month) echo date("a"); //25 (day of month) echo date("¥-m-d") —//2008~11-28 echo date("d/m/y") ——// 28/11/08 echo date("F d, ¥"); //september 28, 2008 echo date("F 3, ¥, h:i:s a"); //September 28, 2008, 12:11:35 am checkdate @ ec ypstalsesstrucintecber Ale LBS darecth im bool checkdate ( int month, int day, int year } wet! validate Aste Wparameterty SE checkdate(12, 31, 2008); //returns true checkdate (04, 35, 2008); // returns false time() © January 1 1970%_ tebe timestamp. téyzsunix timestamperr Moet te nL bc bind terbae ile tals FerS SPU < timestammse Hig oat EDS PK date se pee ELE Gb Lust stimes tamp SnextWeek = time() + (7 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60secs echo 'Now: ‘. date(*¥m-d') ."\a"; echo ‘Next Week: '. date('¥-m-d', gnextWeek) ."\n"; x output: Now: 2008-11-30 Next Week: 2008-12-07 Bosley Liv pnp neta ya rted£it fd aace tee shakeel599@gmail.com cesscceseces a sysel G58 Gee WANS ai S Gis s) ay sl See Sl alg FP aa aes) (Functions): «= Leth 2 Mol lephh te PE eB puite ine ven l ape LT EL eo ye pr Rath PUL ty LUE Su el Pulegerbut Se eee Ayr hl AK yisle Craw maveriaisdee nul Mee ye Lehiyine ie ev* 00d processor earhwuntbe sb ee tule wget Rt ie the PAL eb tn ate Er bun Frit bn Oe ft le bork Foie ox AIA oS (Tuite idtc EL burn Mh tenI£ Aur (erinder) Hz ef Loi A hot, ‘WLI Lio rhn eo ty dadt Ml Aisa tiitlypbtL WE othe sefolévle Wargumentshe eos abez Lib gerrype Hi Fl S calle dren At eA Aatl oA oh meth tls gettype($test) Lib Hargument fle Pull Pa S te udm Ie Pek Li paey ai ue Any tL argument hkl stestutubdplugE argument Mug tre OL fargumentsnls some_function( §an_argument, Sanother_argument ); Pvoettype Se EF (return) yubbtehebe aroumentoy*edeut eye ten Tile AE ue MU eit ipan Re yah Gt nth nab ee eure A n¥ eunctionfL bey function some_function( Sargunentl, Sargument2 ) { /J function code here y CEES UT) erent ET ery NS zon koAargunents htt Artbewi Li tel tunctione Lt, is, wtboy thai S save tL function phathtdocst pel ibetrigt Declaring a Function HELLO!"; - bighello(); > output: HELLO! argunentute™ Une Lut argunenth Mlle pt bighello fd ftltut white Lez Sthigis Age argumentzve GrenAtge tsar eat IRMA Be PAL car hfe vigneroyefgi At Up argunent HAL iret P LES car strc lz br Fi ~O arguments up Lb iA LxSilrargument er Ung LS ZB cheat Declaring a Function That Requires Argunents</titie></heaé Sbody>caiv> <7php function printBR( $txt ) { print ( "$txt<br />\n" ); d printsR("this is a lin printBR("This is a new line"); printBR("This is yet another line"); a> </dive</body></html> output: This is a line This is a new line This is yet another line em argument Lake eve (tls tari cathe tL printBR iL Autueu! FIL LS ca Pee ery SiG avoumenesifite ee A nh EV argument BAI le call shh PAL Ff SB he hs Fargumentfi CLIT ta Ae Ble ube ar FUL ot dysstxtd argument ul ak UAE AUR yp Sabb tae to Fi peg ceil FP aa Ns) yj cto <head> <title>A Function That Returns a Value
    Output: 8 peg Lute Vparqumententitee iti Le tC adanumed AtUeu ee Ajab ie e returned rut ltys resul there SFL FE Soy CPE be phic oP ute Sy il sresultie eck print addNums(3,5):2VULGuusle V cal PALL toy Hl Aout eS displayg@Uprint ul Sys sresultL Gul Aus, Variable Scope a phagmut ZL Local variabloMe tae ty sre Liil A phir mt PIS he Lbs overwrite LAPIS vf AS cAI gL abl peste ep tebe nS be eg the PU A Ag Lbasil A ey He geo Ie heated Sa iaa MLAS ef ee “tens? Soars "; >
    Output: test variable: She oSdostring hid Aik puter he Sethe de AUP eine WE Butler bi tsp fre tule rest WL pstestvariable Ut ferrorb Insert tS accesses ted me IS global Statement = DEL rhe eer AP accossthe PW ALA Ue OEE Le pai rect EL lly Ad ot No Default Access to Globals in Functions
    "; , myage 0) + > Output: My age is: CEES To) ane ea NS Uren te LEE Kept Z myagehb Func tl sageoic fututut eticy Sut direct access pL Git Mitoutput A Fine pol ce Af af overwnitenmslith bye le sat Au! LP CLS Hig bal FLL WTS tA Ph le Men ASL orl Seb UA Hee ZA Accessing Global variable in Functions
    "; ) Myage() >
    Output: My age is:42 tS accessH tabi sage the PA be Gg topal ie pt ei PLA AMZ access? ey thlie Me 2bLg Wy wile yl erp kye phot (,) aie Ew£ global global $varl, $var2, $var3 static Statement = Go al 2 wrunsinl Fc tek Nc try static statment wt JOEL ao Using the static Statement CT Gere aaa as Pde ES)
    $nun_of_calls"; y numberesxe () ; numbereExe () ; numbereExe () >
    ‘output 1 2 3 vite Hysstaticfiet£$num of caliswi&i(ktunctione ptOnumberExeL A FLA te Le hh P hte increnent#Rpstarioe; Aik gob oF eesti yeh S statict ie Gob SUpstaticMtaty, we calls Bri tbdydieystaric eke assionfds om eet le S66 be 1,1 Sarrrdo dig he toS skipAnteig (.ArgumentsL7) « Gia glwargumentsL mtr Aye hic arguments Pay kia el Cerror Guia aut Fifunsivargument GE PAA (optional yaa! Ufer. ror bi Ger in rgumentsahyeArgument sUAPLGtLy BL geikddetault foptional argument he Weide default ihe» eile (ond) (Ay optional Argument Stxt"; } headingWrap("Book title", 1); headingWrap("Chapter title", 2); headingWrap("Section heading") ; >
    output:Book title Chapter title Section heading yo REL Se Y argumentig up esL arguments» ule POG L Rut Teg! (optional UPI e Ue Unbide fault HL ARs headingMargument Sab IL dh VtargumentL§sizentgl cal sip AAV etargument eebuyissized ie S1,2,3... teurtagLarmnL A bosS assign eke oar shih pe ee pe Mii Fes, 2,3... fori dot Le stag Lsna> vise ut US i kept Ce tL BI Fbdetau ltd ML 1 errorbe ute AUF argumentL£ $size be tagh "Lahore" , "pwr's>" Peshawar" ,""isb"+>"Islamabad’) ; $cities["rwp"] print $citied"pwr"]; output: Peshawar associative lye U%eLytshort (PUI LE CAL AS dette! Sebi teh Ug ode blir h eet b aS yarcay Scities = Rawalpindi"; hth Bsc Le eh AS AE Ae Le tcitids #£fUevector array Sys\lcr fic Git ysiC par vlarray EVE oe ef Welements pUutvector Array uf associative array “/UbPuP Bu torr thie dd ual elements Zid nZ/ definee MC tle tr Lidatatype ExU PA Unttc if 100 double-precision floating-point numbers ff double my_array[100]; // This is C, not PHP! aT Poereed) owen ty) (eo Sod tl merbegvector arrays Sar svhL fea Setividatatype lft tihpe Pett access ¥ array < Block oLFecA KU tet compiler ML EL AG Ut starting farray iG rf ew Ere dewl TF slot SLarray SHO! Oe AiG L er idirect yA ttle 5,67 index shld elements Meu! See ial bau Aid ferement Wut Le plassociative Sy papgt S Sixt Atifidatatype f elements UU“Le daslot yiipnpitl Sew element gindex & Lo MA Sug Lartype-looseness CAS yeu « zylPne- fen? MySQ Uleunetvector array-fXSedouble ye #7 fetring 42 reinteger (Leb gd Pit index Zit Lau Ut(numerical order elements intro i tig Hiytenr te Cnt inceger t+ mpl Uerieya tli Gur a Sta Vout UCL Wee fib iti $my_array{1] = 1; $my_array{"orange"] = 2; Smy_array[3] = 3; G, orange, 3 key Dtizs(1, 2, 3)ufelement sufi & associative array Ly we ho OL Pe Me Multidimensional Arrays = usPelements Le poL Uuitiple tors Selement bee sbyl AL FrFarray slflobject Arrays array ( "name" => "Shakeel Muhammad", "designation" => "Web Developer ", "age" => 28, "skills" => "PHP, MySOL,HIML, Javascript ,AJAX,Flash " » "employee2" >= array ( "name" => "Majid Ali", "designation" => "Web Designex", "age" => 27, "skills" => "Photoshop Dreamweaver ,CSS,HTML " “employee3" => array ( "name" => "Arsalan Mamon", "designation" => "Database Administratr", “age” => 32, "skills "oracle" ) : print § employees ["employee1" ] ["designation"] ; > output: Web Developer ypdlefiteterenentss Bi teufoe bie fle ptLsemployees LAE! Licey! Semployees Pee esi LigAiyute slsemployees Uleed ALE Uibitfuntl access sf employee] HLA /\Semployees tkIL Seyelement mnt Mole sedan IdesignationLZlec ying aT Poe) SOP) (foreach loop) (62/U%'y! # pi LiF ule & WMedo.while sifor,wnile ery Sox wk Leu fe yi ene teil Ao keysterenents Less par reset 2 Ant (foreach) jE MLR LES ie LO te ie er Eb LAr it stor lL A Vivi) \n"; Output: Saturday ‘Sunday Monday ‘Tuseday Wednesday ‘Thursday Friday LA toreach fete A ib EPL ik estore the pg Sap Rutz SPvuinkeys slelements fassociative array fiix -< ty foreach foreach ( $array as $temp ) { Me } 4p Sis element 2 ys Listemp BZ vO tL i sisarray tery tA liane bt AMe i bL associative array Lidtkeys A/G Le foreach ( Sarray as $key => $value ) { Me , em maaan SURAT ES) Felenent Lisvalue 4 Le pUiskeyund pti fut CLI suisarrayu) ei tesp Lee tify \n"; yp Ususvaluewskey Ke A y > output: Saturday Sunday Monday Tuseday Wednesday Thursday Friday wikeysL£ associative array fife UKs foreachs ykeohe Joubes -ud APousvelements "Sunday", "mon" => “Monday” , Tuseday", “wed” => "Wednesday", “thu” => "Thursday", "Eni" => "Friday" ); foreach ($days as $short => $fullname)( Print §short . "=". $fullname . "\n"; ? > Output: sat = Saturday sun = Sunday Monday tue = Tuseday wed = Wednesday thu = Thursday fri = Friday ee ee SOLS) U*curtshort Lut yi Se associative array HuleSut eukne tutu LAP Aiitreys Ut eysSshort eeylefilte Lsdaysh fle ey toreach-ut mele thinned Medsi*element & $fullname Aut t6—/tMultidimensional Array = phil bl toreach bef Mike a AL SUL 6, tual tidimensional Array Sep Util Arrays</TITLES> </HEAD> <BODY> <?php Semployees = array (array ( "name" => "Shakeel Muhammad", "designation" => "Web Developer", "age" => 28, "skills" => "PHP, MySQL, HTML, Javascript AJAX, Flash " , array ( "name" => "Majid Ali", "designation" => "Web Designer", "age" => 27, "skills" => "Photoshop, Dreamweaver ,CSS,HTML " , array ( "name" => "Arsalan Manon", “designation” => "Database Administratr ", "age" => 32, "skills" => "Oracle" ) foreach ( $employees as $employee ) { print "<p>"; foreach ( Semployee as $key => $final_val) { print "Skey: $final_val<br />"; } print "</p>"; y > </BODY></HTML> Poe) Outpui name: Shakeel Muhammad designation: Web Developer age: 28 skills: PHP, MySQL, HTML, Javascript, AJAX, Flash name: Majid Ali designation; Web Designer age: 27 skills: Photoshop, Dreamweaver CSS, HTML name; Arsalan Mamon designation: Database Administratr age: 32 skills: Oracle outta de Pee ueduiefizelenent uf bie siefiet£ Semployees b# Ute Hite ssemployees wile AEE 00,1, 2 2b Aiea Ebene foreach ( $employees as $employee ) JU ye-ufielement 4 Ue Sete iA tSemployee f element Leylsemployees A Ute Bite sSemployee AU eye Gute gifitsemployee ie foreach ( $employee as $key => $final_val ) Sik Agen SPousvelement whey £istkte associative array Lyfe siete dnsesfieirtsemployee ouley Si tel futyeute” Au be YB ‘Ajunszselements Pun? gzslelements ALne sel Pethyptalsesstructte sfibbnt Ae yp ubboolean se We sibie® foreach ( Semployees as Semployee ) { if (is_array (Semployee)) { foreach ( $employee as $key => $final_val ) { print "$key: $final_val<br />"; , Catal they. dey Pedy Em eusoxeys sloLements Levine Ute Aula pibifie ube eee tI S examined z! ’ print_r() . Aj <htmt> <head> <title>Testing the print_r() Function "Ali "designation" => "Manager", y array ( "name" => "Ahmed", "designation" => "Assistant", ) : print "
    ";
    print_x (Semployees) ;
    print "
    " > output: Array ( [0] => Array ( [name] => Ali [designation] => Manager ) [1] => array ( [name] => ahmed [designation] => Assistant ) te tcount() = tc tei elements segs $months = array("jan","feb","mar", "apr" ); print count ($months) ; output: 4 is_array() = Ute yptalsesstrucing fine th gir $months = array("jan","feb","mar", "apr" ) ; print is_array ($months) ; $str = "Hello world" ; print is array ($str); output: true false sizeof() = ater AS count () Hh in_array() = oige LGA Abelg< Hlarguments nS tle wer te EE LG oh Ut-etlypstalsecatruciorrd tl Aga iu pike ei largument $months = array("jan","feb","mar", "apr" ) ; print in_array ("jan",$months); output: true $months = array("jan","feb", "mar", "apr" ) ; print in_array ("may" ,$months) ; output: false PE Ca ra) Cen eT us array_merge() = Ue Vy siete $first = array("a", "b", "c"); $second = array (1,2,3); Sthird = array merge ( $first, $second ); foreach ( $third as $val ) { print "$val
    " ; ) array push() © Gre dmargunent bb Lhe tHE SEW elements LS Le neh wi Sate puyieS um epunteyifrelements wo Livigg 2 Guia ume Ue fii erenents SUPT e ete re yal elements Sfizst = array("a", "b", "o"); Stotal = array_push ($first,1,2,3); print "There are $total elements in \$first

    " ; foreach ( $first as $val ) { print "$val
    "; ) print "

    "; array_unshift() « eV elements KlALe pee tPeE AS array push Mle array shift() » Urner iAE SY element Klee Sary = array( "eM )a array_shift (Sary); foreach ( Sary as $val ) { print "$val
    " ; d output: bc array_pop () SE Kaur eto phet/Frelement t-et/P element fe Fle ns Lf assigniMystruit Hull fie element 1k pRrespherry L AUIE $stack = array("orange", "banana", "apple", "raspberry" ); $fruit = array_pop ($stack); print_x ($stack) ; Output: Array ¢ [0] => orange [1] => banana [2] => apple sort () Jt< tf sort ytascending order SelenentsLeghy $an_array = array ("x", "a", "£", "c"); sort ( $an_array ); foreach ( San_array as $var ) ( print “$var
    " ; ) ete rsort () DACIMLAS descending order asort () associative array \ Ut-5, "second" =>2, "third" =>1); asort ( $first ); foreach ( $first as $key => $val ) { print "Skey = $val
    ee ee FOLIC) CSO Can) owen ent RT se) ksort() m keys associative array” tet’ sortutascending order GA >5,"al=>2, $first = array (" ksort( $first ); foreach ( $first as $key => $val ) { print "Skey = §val
    "; =>); } output: a=2 £ 1 x=5 array_sun() Re tiypssumbiel er $a = array(2, 4, 6, 8); echo “sum(a) =". array_sum($a) . "\n"; $b = array("a" => 1.2, => 2.3, echo "sum(b) =". array_sum($b) . "\n"; output sum(a) sum (b) array key exists() m (Pie tp falsesstructetr key eee key SOute hTe the $search_array = array('first' => 1, ‘second’ => 4); if (array_key exists('first', $search_array)) { echo "The 'first' key is in the array"; } 899009005000 emma ea Lia Ms see BR OS ay lh Seg Sey Ie ole gale ariel, Pinete Js postals_cardtuuifergethcl Ate die beartro dE ei pee BEugemara ty bicalglen£ ane UE LI Un Set 10 dite Ainge Writ Sneed” viti82$_ SERVER = Leena bnew We ise URAC te yl —UtLc element abi Filf terpitroeh hth Suih- dng Site 1h #source/listing1.php bhetuite SFE action LeornFutin $_SERVER('PHP_SELF!] mete erie wal Mozilla/4.6 ~(X11;T;binux2.2.| Ae bkuiiie uy £ of |¢_ seRVERT HTTP_USER_AGENT") 6-15apmac ppc) “ct Ajee 156.152.55.35 et MiAAtrpKetw | smrver['REMOTE_ADDR'] Post name=khan address=unknown, fecetwedirequest & Post eteiiesv querystring ]$_ SERVER [ ‘REQUEST_METHOD’ ] Is_SERVER[ "QUERY_STRING" ] fphpbook/source/Listing10.1.php? name=khan Udquerystring surl ae ti} iS_SERVER[ 'REQUEST_URI"] http: //p24.corrosive. co.uk/ref.htm Sfrequest ednGu $_SHRVER[‘HTTP_REFERER' ] Ciena) Coren Tt CT RTT TS wh Au S% (tL server_array.php Mt APSA Uke s_ SERVER] eb LYLE EE $_SERVER array
    $value ) { print "\$_SERVER[\"Skey\"] == Svalue
    " ; } 2
    po bgidevisérs / Liha ed pte face ual dive aes LE Fuse Liftauery string A Littl be wwe he LIM Ge uy opine Se aA ek See Li eb iit wie Lee heel Ji pig eo 2b A tifa tay LS Po GL gee Puce Enpinlic GEES ¥ ne So JeriJavaseript WE Rute rt tr ELSE PRs bn brn Moe iale br Sr Atte, L ob oe JE pea SPL ue AL oie L BOL ile recpidice re arin eh he bre Pobltit ELEMENTS< 7 online fairl felcontrol melements £pbAL ms eas MLL)
    tA twit helements 47H 6L¥
    ust Be eb tiL PA IA TEER Py fe yh sh) CeomeT ema SS ~u2/b%x tL form_textbox.ntml Uthtdocs (6. Letktext box Forms Who is your Favorite author?

    Lorms sphpethtdocs GULL bev pap iekle hf BL po) eet A Forms</titie></head> <body> your favorite author is: ‘<?php echo $_GET[*Author’ J; > </body> </html> Spl sintep: //locathost/form_textbox.html uf/address ¢ Ut W54 ¢l they EMosle tr er GL coms.php pOige Mitel HA trextbox dob fey niu et die Lrivcet tegplactionL pbb Age Pin$ Pods au febtes cer @L tors php-Si 1 taverystring $1 fan ptle trp ROE AL Unti tule th ope Ute dee ihiebiey Ue As_cer[ author") teal sf auchor sty text box Vit A ob Pie # elements AL pigs, Se tiMotrt LL eee ea pauthor Let tere mite te nie THL Pod HE opt ORT Felement sii comida MLS LAP oievilesyls post] ie Post Ale ys_cerl] ie WU IGETuRaction unerrtace/ element ute Ee iL AEC Mee pttg etailh < Lecase-sensitive Umut Mosute stunt ageute tel Sod fst fhwytiharps vostg.6S cetutu bu OL gs ‘Text Areas LPL Nrw rextarea Ew ttle Lu ntext boxwIoe veh Jeet Leif cols trons Mie uk Ald textarea <textarea cols=30 rows=8 name="txt"></textarea> Wer Sixt E re 30S herd Su Fie tutptOalhtextarealiL a Leextarea hemo pl AUeW textarea tlt bp Agee gieiglx Aaa pt a oe <head><title></titler</head> What are your favorite web sites? <textarea name="WebSites" cole="50" rows=' http: // gi ita: =| : htts:// netp:// ‘</textarea><br> http: if a <input type="submit" value="Submit"> </form></body></h tal> ~L/o%— tL textarea. php Sx} ZB <ttnt> <head><title> Your favorite web sites are: ‘Class-11(Page:6) erent ET eT TS wfisltextarea fipi-< LW Poste AUK < ends we Sey Chine Wie y¢_post¢ELphpd cat ‘CheckBox PS Ae -tef checkbox ttype Rutt UE IL input PLLA Ate J Lob uBpbdefault FL GE AB BPs Ake Jie bet a Pd A ichecked Do you agree with us ? ‘

    oa pt checkbox. php vip ben ae Sains Pong LEE on GL Ty Se LL AG AG tA ttf checkbox. html CCU ag) Coren Te OT eT TS LAGNA IDEA tee SSSA Bite bef A ge poLassiont bid Mitte rit, Senul ie Bol inure S AGA on Glristamabad da Kiln But Le, S19 A Lobia Li Sen iO re pt sil to ALN, AL pike Gute Zutpise Forlag £ Gb sy AGS Sl gel fo One tyete gti eng, -w/e¥= pt Lmultichk php (8 teh i£($_POST['post') ( Higetting checkboxs array $chk = §_POST["chk']; /feount items in array Print "Number of CheckBoxs Seleted=" . count ($chk) . "
    "; Print "You visited the following cities:
    " ; //looping in array foreach (Schk as $value) { print $value . "
    "; n >

    Select the Cities you have visited:

    Islamabad:
    Karachi:
    Lahore:
    Quetta:
    'sLamabad">
    LE) end Lee bpti Live lege WAG til Ste hing but Ceara) Coren Te ET PTS (Mele le ee Sinidden Kite Se Buupiie Very ut bruSersikk (i£($_POsTE'pest']) eRe yegL pce eee SAILOR PABLb IF corm $y be uta 6 pa 21 nui ds Sin idden? PISA SF Aste SoM L1s_PosT sles epi FILER Yt ev-Gerror di Siriadeni£ Lf submit wL£ LS serect AG te Liyerror SIL LS ero tie pup SL at rue HIE ite eV sie SE grt rue Radio Button fh Ble y2 LAL Se Sok E Mut AB td nt SAGAS BE Lee option VfL As tRadio buttons Bur ©O Purbradiotextltypeft Zit

    Gender:

    Male: pizL nd OL re Le RIGA te Be le Ben PSEU pI Be ee Whidden Ley Liner Mee OAS he BLinputst, 1e"> female"> ‘female"> if male">
    female">
    wt itil Sos tothe he CoC A Uh" Ee FI Ute bio Hig AP ke REM vids fi tifusa tern Lvalued th eS PIL iy Kes, List Boxes LW TA EE Ei tense Gut er Lih rut Ave ety ui et Kite tai WL seh Sie Lie te Lilt Eni t rie Pakistan ~ " Pept ELLOS option SMALL hI IIL ITA fidl Blue Avhite ape O ELA Wi Hinbin LAS" AG ite Mien ~ffi%aptE listbox. ntmviy 1(Page:10) (i chead>

    Select Your Country:

    Select your Favorites colors:
    LALA Ber Fie Si Le pt£1i stbox.php—! listbox " . §country . "
    " ; print "Your favorites colors are"; foreach ($fav_Colors as $color) { print "" . Scolor . " "; + > PhS Pe ALL colors sy oh fe HL country fli stbox. html y! SPA Sel tie Whe whl fda AG ete ew le Se ot Litemte tre Geib fi, tdetuale Fest dite ppiCvalue ut$Loption Stassigntal(tcoption sf items L ASU tuespiL~ leet Syl label for eee UT Ce) Cowen Te CT RTT TS Ure fib tL >Iran 1H" >China wLpakistan AG EY item. dn Meade optionuteun treba tent Set &S assign ibe wil paki stan eSn bree Mie eet LS Buf selected tL iB hidden PigBe pre BL bh to PUL winger ee tnt ASLO Sshiddenut type MUR uta TE Pde Ur tee eet YriLLes boa tue if BESO PUL Ler Ase Sb be 4 fs dept Grint te UES oleh et SSL HUAPUL I AS ih FL ne AS Line GL Puget password fut ype He Be Fcinput> els eeeeee eae) examen MEGS (submit,reset hese eUUCHEN Reset kL Vee rE Ltn eo bes submit button ew LL Letty Lee set tibtieaes eb reser ae Pue ie etd Bi PLL EG ipl SA nt ppl url resetutenfltype Eee ees Py LS poly tote Puc ee i! a Form ar Web Developer Required

    Please Fill the following form to apply for this job
    Name: Cian UCLA )) erent ET eT TNS -U-4s% tL application. php {Ubu application. php (& $value) { $value = cleanStr($value) ; if(empty(Svalue)) { print "" . ucwords ($key) . " must not be empty. Plase Click the browser back button and correct it. return false; y ) return true; ) /fcalling function to check any empty value if(lemptyFields($ POST)) { exit(); ) Jf check required skills and age function isEligible($skills,$age) { $age = intval (Sage) ; i€(count($skills) == 0) { print("You dont have any skill"); return false; em ee LSS if(Sage < 23 || Sage > 35)¢ print ("Your age must be between 23 and 35"); return false; } return true; ) J/assigning fields values to variables Sname = cleanStr($_POST['name']) ; Sphone = cleanstr(§_Post[ 'phone']) Semail = cleanStr($_POST['email']); Saddress = cleanStr($_POST['address']); Sgender = § POST['gender'] ; Scity = § POST['city']; Sage (int) cleanStr($_POST['age']) ; Skills = § POST['skills']; Wealling faction to check J/that the candidate is eligiable for applying to this job 4f(1isEligible($ skills, Sage)) { exit); ? (/4£ every things is print "

    Thank your ". $name " for you intrest in this job. We will contact you soon."; print "We recived the following information about you.
    "; J/printing user submited information print "Name: ".. name . "
    "; Print "Phone: ". $phone . "
    print "Email: " . §email . "
    Print "Address: ". §address . "
    "; print "Gender". §gender . "
    "; print "City: ". Scity . "
    ": print "Age: ". Sage . "
    " print "Your Skill foreach($skills as $value) ( print $value .","; , > Site rniba ile get ¥ validation td JM Wwalidation AL Pepi GaP End PpsL validation tke Rut ids Sook ater nut ean ves Ere erT J Seema MAGLI © 0 HAG SPeol\eS4- p=Kas fy -2* Web Developer Required Please Fill the following forma to apply for this job: Name: Phone Email [ ‘Address: | (Gender. Male: © Female: O City: [lelemobad © ‘Age: ‘Skits EPO e oa Poses a Javascript: (1 [ajo MysQu:O (Ge) Bea) i hitp:f/locathost/application. php - Microsoft Internet Explorer Fie ER View Favattes Tools Heb 7 O=«-O- BAG P= tom O 2-S EF Bah DS Address |i} hetpilecabostjappc ation. php > Ee Thank your Shakeel for you intrest in this job. We will contact you soon. ‘We recive the following information about you. Name: Shakeel Phone: 5555555 Ema shakeel59%@gmail com Address: sdf sdf sdf Gender male City: Islamabad Age: 27 ‘Skils: PHP HTML Photoshop Javascript, Ajax MySQL, Coreen m mm as OLS She teVenptyrields LAYS yc yp Lite 2o aie AS string big’ Tcieanser eS name site Mina SEAL ie cu Liga OOo tesIs_post pre ney eh taarabasee Mn te bth Me LRG Aiptohe cilia bled Pie LT. he By ts Se ite ASE oto te nl tliat! Bp SEABG tng RE i ESE SOG ML ALES ABIL ite en tite f de Sit Lgl Sb ity ial Mate nf@ ke eo 1n0ine Lise Ste WJeWiseriginied AP d.6 pbetilne SAUL WEL este OFA Ferg ec giLitte skitist) ptOnuti A Guth Visage slsskil1s-¢@arguments bl Agolte biM be ifite mL Ae $_post[ skills") Uey$ski lls Sard Lge uh count LI ivemsLepupte te Bout abe OWL wee trot elements te suns Gua OL ye Se lr skilis wfhitt lL Bille SAL wiAtiielsage-L AGE applicatinuPeeut (guaFt Avia Uesslhytfe Ube eA cmbic Jh35 falofe 234 See Me wR Ie A Kouttywib we Cys post El dpd nolnL 35 sla ff West SP ier es eerie Legs heist ERE ALG EL Le itd aU eM AF ale Gp IPR GF Te PP exit() BE be Ue re pUplet-ct/PY executions, Atte Wiriexit Ae oiLaedeut tot Pexecuter, fam ole ANC Ante pnt phe sLiewiiht Bute ek Chee exit ("Your email is invalid"); exit) Buble Le OAS oni tM ng 8 aie Me Lh SUAS exit Mrpup iy ru flaiey cbt die ("Your phone number is invalid’ BEML Ed AUsbe-Untrbe sol OPEL kek Te STOEL Unt et ob sare pub shakeel899@gmail.com Sooseoooso—e Creer) over 19 24 PHP, MySQL 0000000 ‘sibel 9 co00000 eel tebe ted ye Set Je iElementL¥6_1$_SERVERL Le AIP” a) at Pott te AL iit” ULE te Heitiuinetine iC request get & SUL AEE eBdievtexit LiKE 22 phat Spee ‘eth JGe HTTP Request /elements2 Leb 2 Chloe Se SAGuityL See winseeen Labs ” Oteale or ete SAL AL EB Hiddendy kr fink Large eA euinw ext? teilsHidden Feb Jee HTTP Request /ilHidden ir Grutids SiBHidden ir we PY tle WAPHPL uturtLelementvitiour [chkDel] :r chkDel : 1 chkDel[samevalue]:" chkDell] : PAPE Une tek np LG Ae Bes ealculator fi :3 yt pst Lee bres WL pig hth Sec Ei fe St LL pity pe erorsiL —Tipiksuble Aecpiseuig ie t/ Fie validation LP Prt h Ge Klett sige igh Leaf Ale SA He oy oh pte pa tybe Meum ie GALLS TEABS display CL ole eh Seeuit LSA GTI 7 Ori i740 dT

    You might also like

    Phone:
    Email:
    address:
    Gender:Male i Fenale:
    Skills PHP checkbox" name="skills[]" value="PHP">
    HTME:
    Photoshop:
    Ajax:
    MySQL:
    anbsp;