+ All Categories
Home > Documents > Php Mysql Chapter_01

Php Mysql Chapter_01

Date post: 02-Jun-2018
Category:
Upload: goingforward77
View: 251 times
Download: 0 times
Share this document with a friend

of 44

Transcript
  • 8/11/2019 Php Mysql Chapter_01

    1/44

  • 8/11/2019 Php Mysql Chapter_01

    2/44

    C2 9he scri0tE element'2 Short PHP scri0t delimiters.2 >SP%style scri0t delimiters

    &2 Standard PHP Scri0t Delimiters

    9he standard method o/ writing PHP code declaration blocks is to 3se the 60h0 and 6Escri0t delimiters2 > delimiter is a character or se?3ence o/ characters 3sed to mark thebeginning and end o/ a code segment2 5hen the scri0ting engine enco3nters the 60h0and 6E scri0t delimiters, it 0rocesses any code between the delimiters as PHP2 9heindi8id3al lines o/ code that make 30 a PHP scri0t are called statements2

    60h0StatementsB6E

    $otice that PHP statement ends in a semicolon2 9he scri0ting engine ignores white s0ace

    within code blocks2 (5hite s0ace F s0aces, tabs, and newlines)$A9! the PHP Gro30 o//icially recommends that yo3 3se standard PHP scri0tdelimiters to write PHP code declaration blocks2 Ane reason is that standard PHP scri0tdelimiters are g3aranteed to be a8ailable on any 5eb ser8er that s300orts PHP2(#oth short PHP scri0t delimiters and >SP%style scri0t delimiters can be disabled2)Howe8er, the 0rimary reason /or 3sing standard PHP scri0t delimiters is that they are theonly method that is com0letely com0liant with :ML2(See e7am0le cha0ter&&20h0)

    C2 9he scri0tE !lement> second o0tion /or creating PHP code blocks is to 3se the :H9ML scri0tE element2

    5hen the scri0tE element is 3sed with PHP, yo3 m3st assign a 8al3e o/ PHPI to thelang3age attrib3te o/ the scri0tE element to identi/y the code block is PHP2 5hen thePHP scri0ting engine enco3nters a scri0tE element with 0h0I assigned to its lang3ageattrib3te, it 0rocesses any code within the element as PHP on the ser8er be/ore ret3rningthe 5eb 0age2

    scri0t lang3ageFJ0h0JEstatementB1scri0tE

    $A9! Like the standard PHP scri0t delimiters, the scri0tE element is always a8ailable

    on any 5eb ser8er that s300orts PHP2 n/ort3nately, the scri0tE element@s lang3ageattrib3te is de0recated in :H9ML2

  • 8/11/2019 Php Mysql Chapter_01

    3/44

    '2 Short PHP Scri0t Delimiters> sim0li/ied method o/ writing PHP code declaration blocks is to 3se the short 6 and 6Escri0t delimiters2 Short PHP scri0t delimiters are similar to standard PHP scri0tdelimiters, e7ce0t they do not incl3de J0h0J in the o0ening delimiter2

    6statementsB6E

    $A9! nlike the 6 0h0 6E scri0t delimiters and the scri0tE element, which are alwaysa8ailable on any 5eb ser8er that s300orts PHP, the short 6 and 6E delimiters can bedisabled in a 5eb ser8er@s 0h02ini con/ig3ration /ile2 #eca3se a 5eb ser8er on whichyo3r PHP scri0t will r3n might not always be 3nder yo3r control, the PHP Gro30disco3rages the 3se o/ short delimiters2(See e7am0le cha0ter&&20h0)

    .2 >SP%Style Scri0t DelimitersSome 5eb de8elo0ers 0re/er to 3se the >SP%style scri0t delimiters o/ and E tode8elo0 PHP scri0ts2

    statementsBE

    $A9! Like short PHP scri0t delimiters, >SP%style scri0t delimiters are com0liant with:H9ML, incl3ding the strict D9D, b3t not with :ML2 >SP%style scri0t delimiters canalso be enabled or disabled in the 0h02ini con/ig3ration /ile, so yo3 sho3ld not 3se them

    3nless yo3 are s3re they are enabled on any 5eb ser8ers on which yo3r PHP scri0ts willr3n2See e7am0le cha0ter&&20h0N

    nderstanding 0rogramming lang3age constr3ct re/ers to a b3ilt%in /eat3re o/ a0rogramming lang3age2 9he JechoJ and J0rintJ statements are nearly identical, b3t theyha8e some di//erences2

  • 8/11/2019 Php Mysql Chapter_01

    4/44

  • 8/11/2019 Php Mysql Chapter_01

    5/44

    6E1bodyE1htmlE

    htmlE

    headEtitleEPHP !n8ironment "n/o1titleE1headEbodyEh&EPHP !n8ironment "n/o1h&E0E0h08ersion() /3nction ret3rns the 8ersion o/ PHP60h0echo 0h08ersion()B6E10E0Eend8ersion() /3nction ret3rns the 8ersion n3mber o/ the end !ngine, which isPHP@s scri0ting engine

    60h0echo end8ersion()B6E10E0Einiget() /3nction ret3rns the 8al3e assigned to a directi8e in the 0h02ini con/ig3ration/ile2 ;o3 need to 0ass the name o/ a directi8e to the iniget() /3nction, s3rro3nded by?3otation marks2 !2g2 iniget(Jma7e7ec3tiontimeJ)60h0echo iniget(Jma7e7ec3tiontimeJ)B6Esecond210E1bodyE1htmlE

    4ase Sensiti8ity in PHPnlike :H9ML and =a8aScri0t, PHP is case insensiti8e2 ;o3 can 3se any o/ the/ollowing 8ersions o/ the echo statement witho3t recei8ing an error message60h0echo J0ELine one2 br 1EJB!cho JLine two2br 1EJB!4HA J and Line three2 10EJB6E

    $A9! !7ce0tions to PHP@s case insensiti8ity incl3de 8ariable and constant names,which are case sensiti8e2

    >dding 4omments to a PHP Scri0t4omments are lines yo3 0lace in yo3r code that do not get e7ec3ted, b3t 0ro8ide hel0/3lin/ormation2PHP s300orts two kinds o/ comments line comments and block comments2

  • 8/11/2019 Php Mysql Chapter_01

    6/44

  • 8/11/2019 Php Mysql Chapter_01

    7/44

    U43stArder F .BUSales9otal F U43stArderB

    Dis0laying Tariables9o dis0lay a 8ariable with the echo statement, yo3 sim0ly 0ass the 8ariable name to the

    echo statement, b3t witho3t enclosing it in ?3otation marks2

    UToting>ge F &+Becho UToting>geB

    "/ yo3 want to dis0lay te7t strings and 8ariables in the same statement, yo3 can 0ass themto the echo statement as indi8id3al arg3ments, se0arated by commas2

    echo J0E9he legal 8oting age is J, UToting>ge, J210EJB

    ;o3 can also incl3de 8ariable names inside a te7t string, altho3gh the res3lts yo3 see on

    the screen de0end on whether yo3 3se do3ble or single ?3otation marks2 "/ yo3 3sedo3ble ?3otation marks, the 8al3e assigned to the 8ariable will a00ear2

    echo J0E9he legal 8oting age is UToting>ge2 10EJB

    #y contrast, i/ yo3 3se a 8ariable name in a te7t string enclosed by single ?3otationmarks, the name o/ the 8ariable will a00ear (not the 8al3e o/ the 8ariable)2

    echo O0E9he legal 8oting age is UToting>ge210EOB

    Modi/ying Tariables;o3 can modi/y the 8ariable@s 8al3e at any 0oint in a scri0t2

    USales9otal F .B 11 declare and initialie 8ariableecho J0ESales 9otal is UUSales9otal10EJBUSales9otal F -B 11 change the 8al3e o/ the 8ariableecho J0ESales 9otal is now UUSales9otal10EJB

    De/ining 4onstants> constant contains in/ormation that does not change d3ring the co3rse o/ 0rograme7ec3tion2 ;o3 can think o/ a constant as a 8ariable with a static 8al3e24onstant names do not begin with a dollar sign (U)2 "n addition, it is common 0ractice to3se all 300ercase letters /or constant names2 9o declare and initialie a constant, yo3 m3st3se the de/ine() /3nction2

    de/ine(J4A$S9>$9$>M!J, 8al3e)Bde/ine(JD!L9L>$G>G!J, J!nglishJ)Bde/ine(JTA9"$G>G!J, &+)B

  • 8/11/2019 Php Mysql Chapter_01

    8/44

    #y de/a3lt, constant names are case sensiti8e, as are 8ariables2$A9! yo3 can make constant names case insensiti8e by 0assing a #oolean 8al3e o/9! as a third arg3ment to the de/ine() /3nction2

    de/ine(JD!L9L>$G>G!J, J!nglishJ, 9!)B

    $A9! Standard 0rogramming con8ention is to 3se all 300ercase letters /or constantnames, so yo3 sho3ld a8oid making yo3r constant names case insensiti8e2

    9o dis0lay constant, yo3 can 0ass a constant name to the echo statement in the samemanner as 8ariables2

    echo J0E9he legal 8oting age is J, TA9"$G>G!, J210EJBecho J0E9he legal 8oting age is TA9"$G>G!210EJB

    5orking with Data 9y0es> data ty0e is the s0eci/ic category o/ in/ormation that a 8ariable contains2

    PHP s300orts /i8e 0rimiti8e data ty0es

    Data 9y0e Descri0tion

    "nteger n3mbers 9he set o/ all 0ositi8e and negati8en3mbers and ero, with no decimal 0laces2

    logical 8al3e o/ tr3eI or /alseI

    String 9e7t s3ch as JHello 5orldJ

    $LL >n em0ty 8al3e, also re/erred to as a

    $LL 8al3e

    9he PHP lang3age also s300orts re/erence, or com0osite, data ty0es, which can containm3lti0le 8al3es or com0le7 ty0es o/ in/ormation29he two re/erence data ty0es s300orted by the PHP lang3age are arrays and obXects2PHP is a loosely ty0ed 0rogramming lang3age2 Loose ty0ing is also known as dynamicty0ing beca3se the data ty0e /or a 8ariable can change a/ter it has been declared2

    U4hangingTariable F JHello 5orldJB 11 StringU4hangingTariable F +B 11 "nteger n3mber

    U4hangingTariable F -2'V*B 11

  • 8/11/2019 Php Mysql Chapter_01

    9/44

    $3meric Data 9y0esPHP s300orts two n3meric data ty0es integers and /loating%0oint n3mbers2"ntegers are 0ositi8e and negati8e n3mbers and ero, with no decimal 0laces (%C-, %&', ,C, V, &, & and &)2

    > /loating%0oint n3mber contains decimal 0laces or is written in e70onential notation2!70onential notation, or scienti/ic notation, is a shortened /ormat /or writing 8ery largen3mbers or n3mbers with many decimal 0laces (%V2&V, %.2., '2&*, 2-C, &2-, C2e&&,'2!&)2cha0ter&'20h0N

    #oolean Tal3es> #oolean 8al3e is a 8al3e o/ tr3eI or /alseI2;o3 can 3se the integer 8al3e & to indicate a #oolean 8al3e o/ 9! and to indicate a#oolean 8al3e o/ LS!2

    "n PHP 0rogramming, yo3 can only 3se the words 9! or LS! to indicate #oolean8al3es2 PHP then con8erts the 8al3es 9! and LS! to the integers & and 2

    cha0ter&.20h0N

    60h0Ue0eat43stomer F tr3eB 11 or 9!echo J0Ee0eat 43stomer Ue0eat43stomer10EJB 11 re0eat c3stomer dis0lay &

    U$3m0ositi8e F CBi/ (U$3m0ositi8e) Z

    echo J0E$3m 0ositi8e U$3m0ositi8e10EJB[

    U$3mnegati8e F %CBi/ (U$3mnegati8e) Z

    echo J0E$3m negati8e U$3mnegati8e10EJB[ else Z

    echo J0E$3mnegati8e is a LS! condition U$3mnegati8e 10EJB[

    U$3mero F Bi/ (U$3mero) Z

    echo J0E$3m ero U$3mero10EJB[ else Z

    echo J0E$3mero is a LS! condition U$3mero 10EJB[

  • 8/11/2019 Php Mysql Chapter_01

    10/44

    Ue0eat0l3s& F Ue0eat43stomer Y &Becho J0Ee0eat 0l3s& Ue0eat0l3s&10EJB6E

    >rrays

    >n array is a set o/ data re0resented by a single 8ariable name2;o3 3se arrays when yo3 want to store gro30s or lists o/ related in/ormation in a single,easily managed location2

    Declaring and "nitialiing "nde7ed >rrays"n PHP, yo3 can create n3merically inde7ed arrays and associati8e arrays2 (>ssociati8earrays will be disc3ssed in later cha0ter)2

    >n element re/ers to a single 0iece o/ data that is stored within an array2>n inde7 is an element@s n3meric 0osition within the array2$A9! #y de/a3lt, the n3mbering o/ elements within a PHP array starts with an inde7

    n3mber o/ ero ()2

    ;o3 create an array 3sing the array() constr3ct or by 3sing the array name and brackets2Uarrayname F array(data, data&, dataC, data')B

    Ar

    UarraynameN F dataBUarraynameN F data&BUarraynameN F dataCBUarraynameN F data'B

    $A9! 3nlike in 8ariables, the 0receding statements in arrays do not o8erwrite thee7isting 8al3es2 "nstead, each 8al3e is assigned to the UarraynameN array as a newelement 3sing the ne7t consec3ti8e inde7 n3mber2

    $ote Most 0rogramming lang3ages re?3ire that all elements in an array be o/ the e7actsame data ty0e2 "n PHP, the 8al3es assigned to di//erent elements o/ the same array can beo/ di//erent data ty0es2

    UHoteleser8ation F array(JMy $ameJ, 11 g3est name (string)

    C, 11 R o/ nights (integer)+2-, 11 0rice 0er night (/loating%0oint)tr3e)B 11 nonsmoking room (#oolean)

    >ccessing !lement "n/ormation9o /ind o3t the total n3mber o/ elements in an array, 3se the co3nt() /3nction2 ;o3 0ass tothe co3nt() /3nction the name o/ the array whose elements yo3 want to co3nt2

  • 8/11/2019 Php Mysql Chapter_01

    11/44

    echo J0E$3mber o/ elements in My>rray J, co3nt(UMy>rray), Jbr 1EJ,J$3mber o/ elements in Hoteleser8ation array J, co3nt(UHoteleser8ation), J10EJB

    PHP incl3des the 0rintr(), 8are70ort(), and 8ard3m0() /3nctions, which yo3 can 3se to

    dis0lay or ret3rn in/ormation abo3t 8ariables2 9hese /3nctions are most 3se/3l with arraysbeca3se they dis0lay the inde7 and 8al3e o/ each element2 ;o3 0ass to each /3nction thename o/ an array (or other ty0e o/ 8ariable)2

    Printr(UMy>rray)B9he 0rintr() /3nction does not incl3de any :H9ML /ormatting tags, so the arrayelements are dis0layed as a contin3o3s string o/ te7t2 9o dis0lay the array elements onindi8id3al lines, 3se 0reE tags2

    echo J0E0reEJB0rintr(UMy>rray)B

    echo J10reE10EJB

    Modi/ying !lements;o3 modi/y 8al3es in e7isting array elements in the same /ashion as yo3 modi/y 8al3es ina standard 8ariable, e7ce0t that yo3 incl3de the inde7 /or an indi8id3al element o/ thearray2UMy>rrayCN F JMore dataJBUMy>rray&N F JLess dataJB

    >8oiding >ssignment $otation Pit/alls;o3 ha8e learned three di//erent assignment synta7es2

    a) Tariable assignmentUMyTar F JHelloJB

    b) >ssign new element to an arrayUMy>rrayN F JHelloJB

    c) e0lace the 8al3e o/ an e7isting element in an arrayUMy>rrayN F JMore HelloJB

    cha0ter&-20h0N

    60h0UMy>rray F array(JdataJ, Jdata&J, JdataCJ)B

    UHoteleser8ation F array(JMy $ameJ, 11 g3est name (string)C, 11 R o/ nights (integer)+2-, 11 0rice 0er night (/loating%0oint)tr3e)B 11 nonsmoking room (#oolean)

    UMy>rrayN F Jdata'JB

  • 8/11/2019 Php Mysql Chapter_01

    12/44

    UMy>rrayN F Jdata.JBUMy>rrayN F Jdata-JB

    1 to /ind the total n3mber o/ elements in an array, 3se the co3nt() /3nction2 1echo J0E$3mber o/ elements in My>rray J, co3nt(UMy>rray), Jbr 1EJ,

    J$3mber o/ elements in Hoteleser8ation array J, co3nt(UHoteleser8ation), J10EJB

    echo J0E9here are J, co3nt(UMy>rray), J elements in My>rray21PE0EJBecho JUMy>rrayNbr 1EJBecho JUMy>rray&Nbr 1EJBecho JUMy>rrayCNbr 1EJBecho JUMy>rray'Nbr 1EJBecho JUMy>rray.Nbr 1EJBecho JUMy>rray-N10EJB

    1 Modi/ying elements 1

    UMy>rrayCN F JMore dataJBUMy>rray&N F JLess dataJB

    1 3se 0rintr(), 8are70ort(), and 8ard3m0() /3nctions 1echo J0E0reEJB0rintr(UMy>rray)Becho J10reE10EJB

    echo J0E0reEJB8are70ort(UMy>rray)Becho J10reE10EJB

    echo J0E0reEJB8ard3m0(UMy>rray)Becho J10reE10EJB

    1 3se 0rintr(), 8are70ort(), and 8ard3m0() /3nctions in 8ariable1UMyData F JHelloJBecho J0E0reEJB0rintr(UMyData)Becho J10reE10EJB

    echo J0E0reEJB8are70ort(UMyData)Becho J10reE10EJB

    echo J0E0reEJB8ard3m0(UMyData)Becho J10reE10EJB

  • 8/11/2019 Php Mysql Chapter_01

    13/44

    UMy$3m F 'Becho J0E0reEJB0rintr(UMy$3m)Becho J10reE10EJB

    echo J0E0reEJB8are70ort(UMy$3m)Becho J10reE10EJB

    echo J0E0reEJB8ard3m0(UMy$3m)Becho J10reE10EJB

    UMy#oolean9r3e F tr3eBecho J0E0reEJB0rintr(UMy#oolean9r3e)B

    echo J10reE10EJB

    echo J0E0reEJB8are70ort(UMy#oolean9r3e)Becho J10reE10EJB

    echo J0E0reEJB8ard3m0(UMy#oolean9r3e)Becho J10reE10EJB

    UMy#oolean

  • 8/11/2019 Php Mysql Chapter_01

    14/44

  • 8/11/2019 Php Mysql Chapter_01

    15/44

    cha0ter&V20h0N

    60h011 >DD"9"A$U7 F &B

    Uy F CBUet3rnTal3e F U7 Y UyBecho J0Eet3rnTal3e a/ter addition e70ression J, Uet3rnTal3e, J10EJB

    11 S#9>49"A$U7 F &BUy F *BUet3rnTal3e F U7 % UyBecho J0Eet3rnTal3e a/ter s3btraction e70ression J, Uet3rnTal3e, J10EJB

    11 ML9"PL"4>9"A$

    U7 F CBUy F VBUet3rnTal3e F U7 UyBecho J0Eet3rnTal3e a/ter m3lti0lication e70ression J, Uet3rnTal3e, J10EJB

    11 D"T"S"A$U7 F C.BUy F 'BUet3rnTal3e F U7 1 UyBecho J0Eet3rnTal3e a/ter di8ision e70ression J, Uet3rnTal3e, J10EJB

    11 MADLSU7 F 'BUy F CBUet3rnTal3e F U7 UyBecho J0Eet3rnTal3e a/ter mod3l3s e70ression J, Uet3rnTal3e, J10EJB

    11 4on8ert string to n3mbersU7 F JCJBUy F J'JBUet3rnTal3e F U7 UyBecho J0Eet3rnTal3e a/ter being con8erted to n3mber and 0er/orm m3lit0licatione70ression J, Uet3rnTal3e, J10EJB

    11 4on8ert string to n3mber, one is not a n3mberU7 F JCJBUy F Jabc'JBUet3rnTal3e F U7 UyBecho J0Eet3rnTal3e with one non n3mber string and 0er/orm m3lit0licatione70ression J, Uet3rnTal3e, J10EJB

  • 8/11/2019 Php Mysql Chapter_01

    16/44

    6E

    >rithmetic nary A0eratorsSymbol A0eration Descri0tion

    YY "ncrement "ncreases an o0erand by a8al3e o/ &

    %% Decrement Decreases an o0erand by a8al3e o/ &

    PHP >rithmetic 3nary o0erators

    9he increment (YY) and decrement (%%) 3nary o0erators can be 3sed as 0re/i7 or 0ost/i7o0erators2> 0re/i7 o0erator is 0laced be/ore a 8ariable2> 0ost/i7 o0erator is 0laced a/ter a 8ariable2

    cha0ter&*20h0N

    60h011 Pre/i7 incrementU7 F VBUy F Becho J0ETal3e o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJBUy F YYU7Becho J0Ees3lt a/ter Pre/i7 increment o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJB11 Post/i7 incrementUy F U7YYB

    echo J0Ees3lt a/ter Post/i7 increment o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJB

    11 Pre/i7 decrementUy F %%U7Becho J0Ees3lt a/ter Pre/i7 decrement o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJB11 Post/i7 decrementUy F U7%%Becho J0Ees3lt a/ter Post/i7 decrement o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJB6E

    >ssignment A0erators>ssignment o0erators are 3sed /or assigning a 8al3e to a 8ariable2PHP incl3des additional assignment o0erators called com0o3nd assignment o0erators,which 0er/orm mathematical calc3lations on 8ariables and literal 8al3es in an e70ressionand then assign a new 8al3e to the le/t o0erand2

    Symbol A0eration Descri0tion

    F >ssignment >ssigns the 8al3e o/ theright o0erand to the le/t

  • 8/11/2019 Php Mysql Chapter_01

    17/44

    o0erand

    YF 4om0o3nd additionassignment

    >dds the 8al3e o/ the righto0erand to the 8al3e o/ thele/t o0erand and assigns thenew 8al3e to the le/t

    o0erand%F 4om0o3nd s3btraction

    assignmentS3btract the 8al3e o/ theright o0erand /rom the 8al3eo/ the le/t o0erand andassigns the new 8al3e to thele/t o0erand

    F 4om0o3nd m3lti0licationassignment

    M3lti0lies the 8al3e o/ theright o0erand by the 8al3eo/ the le/t o0erand andassigns the new 8al3e to thele/t o0erand

    1F 4om0o3nd di8isionassignment

    Di8ides the 8al3e o/ the le/to0erand by the 8al3e o/ theright o0erand and assignsthe new 8al3e to the le/to0erand

    F 4om0o3nd mod3l3sassignment

    Di8ides the 8al3e o/ the le/to0erand by the 8al3e o/ theright o0erand and assignsthe remainder (mod3l3s) tothe le/t o0erand

    cha0ter&+20h0N

    60h011 >ssignment and com0o3nd addition assignmentecho J0EJBU7 F &BUy F CBU7 YF UyBecho U7, Jbr 1EJB11 4om0o3nd s3btraction assignment

    U7 F &BUy F *BU7 %F UyBecho U7, Jbr 1EJB

    11 4om0o3nd m3lti0lication assignmentU7 F CBUy F VB

  • 8/11/2019 Php Mysql Chapter_01

    18/44

    U7 F UyBecho U7, Jbr 1EJB

    11 4om0o3nd di8ision assignmentU7 F C.B

    Uy F 'BU7 1F UyBecho U7, Jbr 1EJB

    11 4om0o3nd mod3l3s assignmentU7 F 'BUy F CBU7 F UyBecho U7, J10EJB6E

    4om0arison and 4onditional A0erators4om0arison o0erators are 3sed to determine how one o0erand com0ares to another2 >#oolean 8al3e o/ 9!1tr3e or LS!1/alse is ret3rned2

    Symbol A0eration Descri0tion

    FF !?3al et3rns 9! i/ the o0erands aree?3al

    E Greater than et3rns 9! i/ the le/t o0erand isgreater than the right o0erand

    EF Greater than ore?3al to

    et3rns 9! i/ the le/t o0erand isgreater than or e?3al to the right

    o0erand Less than et3rns 9! i/ the le/t o0erand is

    less than the right o0erand

    F Less than or e?3alto

    et3rns 9! i/ the le/t o0erand isless than or e?3al to the righto0erand

    \F or E $ot e?3al et3rns 9! i/ the o0erands arenot e?3al

    FFF Strict e?3al et3rns 9! i/ the o0erands aree?3al and o/ the same data ty0e

    \FF Strict not e?3al et3rns 9! i/ the o0erands are

    not e?3al or not o/ the same dataty0e

    9he com0arison o0erator is o/ten 3sed with the conditional o0erator2 9he conditionalo0erator e7ec3tes one o/ two e70ressions, based on the res3lts o/ a conditionale70ression2UTal3e& F &BUTal3eC F J&JB

  • 8/11/2019 Php Mysql Chapter_01

    19/44

    Ues3lt F (UTal3e& FF UTal3eC 6 Jtr3eJ J/alseJ)B

    cha0ter&20h0N

    60h0

    UTal3e& F J/irst te7t stringJBUTal3eC F Jsecond te7t stringJBUet3rnTal3e F (UTal3e& FF UTal3eC 6 Jtr3eJ J/alseJ)Becho J0EJBecho JTal3e& F UTal3e&, Tal3eC F UTal3eC br 1Ebr 1EJBecho OUTal3e& e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1E10EJB

    UTal3e& F -BUTal3eC F *-Becho J0EJBecho JTal3e& F UTal3e&, Tal3eC F UTal3eC br 1Ebr 1EJB

    Uet3rnTal3e F (UTal3e& FF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& \F UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& not e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& E UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& E not e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& E UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& greater than UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& EF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& greater than e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& less than UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& F UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& less than or e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1E10EJB

    UTal3e& F C-BUTal3eC F C-Becho J0EJBecho JTal3e& F UTal3e&, Tal3eC F UTal3eC br 1Ebr 1EJBUet3rnTal3e F (UTal3e& FFF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& strictly e?3al to UTal3eC and the same data ty0e O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& \FF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& not strictly e?3al to UTal3eC or not the same data ty0e O, Uet3rnTal3e,Jbr 1E10EJB

    UTal3e& F &BUTal3eC F J&JBecho J0EJBecho JTal3e& F UTal3e&, Tal3eC F UTal3eC br 1Ebr 1EJBUet3rnTal3e F (UTal3e& FFF UTal3eC 6 Jtr3eJ J/alseJ)B

  • 8/11/2019 Php Mysql Chapter_01

    20/44

    echo OUTal3e& strictly e?3al to UTal3eC and the same data ty0e O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& \FF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& not strictly e?3al to UTal3eC or not the same data ty0e O, Uet3rnTal3e,Jbr 1EJBecho J10EJB

    6E

    Logical A0eratorsLogical o0erators are 3sed /or com0aring two #oolean o0erands /or e?3ality2#oolean o0erands are o0erands that are limited to the 8al3es 9! or LS!2

    Symbol A0eration Descri0tion

    ]] or >$D Logical >nd et3rns 9! i/ both thele/t o0erand and righto0erand ret3rn a 8al3e o/9!B otherwise, it ret3rns

    a 8al3e o/ LS!^^ or A Logical Ar et3rns 9! i/ either the

    le/t o0erand or righto0erand ret3rns a 8al3e o/9!B otherwise (neithero0erand ret3rns a 8al3e o/9!), it ret3rns a 8al3e o/LS!

    :A Logical !7cl3si8e Ar et3rns 9! i/ only oneo/ the le/t o0erand or righto0erand ret3rns a 8al3e o/

    9!B otherwise (neithero0erand ret3rns a 8al3e o/9! or both o0erandsret3rn a 8al3e o/ 9!), itret3rns a 8al3e o/ LS!

    \ Logical $ot et3rns 9! i/ ane70ression is LS! andret3rns LS! i/ ane70ression is 9!

    $D2 (#e care/3l on the o0erator 0recedence2 ]] ^^ ha8e higher0recedence than >$D A, see e7am0les)

    Logical o0erators are o/ten 3sed with com0arison o0erators to e8al3ate e70ressions,allowing yo3 to combine the res3lts o/ se8eral e70ressions into a single statement2

    $A9! 9he logical !7cl3si8e Ar (:A) o0erator, which ret3rns 9! i/ only one o/ theo0erands is 9!, b3t not both2

  • 8/11/2019 Php Mysql Chapter_01

    21/44

    cha0ter&&20h0N

    60h011 >nd o0erator (]] >$D and)

    UGender F JmaleJBU>ge F C+BUiskge F C&B 11 ret3rns LS!i/ (Uisk

  • 8/11/2019 Php Mysql Chapter_01

    22/44

    echo J0Eisk

  • 8/11/2019 Php Mysql Chapter_01

    23/44

    ;o3 can 8iew a 8ariable@s ty0e by 3sing the getty0e() /3nction which will ret3rns one o/the /ollowing strings(#oolean, "nteger, Do3ble, String, >rray, AbXect, eso3rce, $LL, nknown ty0e)

    9he best way is to 3se one o/ the &- is() /3nctions that test /or 8ario3s kinds o/ dataty0es2 (htt011www20h02net1man3al1en1book28ar20h0)(isn3meric(), isstring(), isint(), isdo3ble())

    cha0ter&&&20h0N

    60h0U$3mString F JC' milesJBUes3lt F U$3mString CBecho J0EArignal data U$3mString, es3lt Ues3lt10EJB

    UString$3m F Jan C' milesJBUes3lt F UString$3m CBecho J0EArignal data UString$3m, es3lt Ues3lt10EJB

    UData F VCBecho J0EAriginal data UDatabr 1EJBecho getty0e(UData), Jbr 1EJBecho J4asting do3ble J, getty0e((do3ble)UData), Jbr 1EJBecho J4asting string J, getty0e((string)UData), Jbr 1EJBecho J4asting boolean J, getty0e((boolean)UData), Jbr 1EJB

    Ues3lt F ((boolean) UData)6 J9r3eJ J

  • 8/11/2019 Php Mysql Chapter_01

    24/44

    UData F $LLBUes3lt F ((boolean) UData)6 J9r3eJ J

  • 8/11/2019 Php Mysql Chapter_01

    25/44

    U7 F 'BUy F CBecho JAriginal 7 and y U7 Uybr 1EJBU7 F Uy F YYU7B

    echo J>/ter e70ression 7 and y U7 UyJBecho J10EJB6E

    nderstanding A0erator PrecedenceA0erator 0recedence re/ers to the order in which o0erations in an e70ression aree8al3ated25hen 0er/orming o0erations with o0erators in the same 0recedence gro30, the order o/0recedence is determined by the o0erators@ associati8ity2 >ssociati8ity is e8al3ated on ale/t%to%right or a right%to%le/t basis2

    Symbol A0erator >ssociati8itynew clone $ew AbXect%highest 0recedence $one

    N >rray elements ight to le/t

    YY %% "ncrement1decrement ight to le/t

    (int) (do3ble) (string)(array) (obXect)

    4ast ight to le/t

    _ S300ress errors ight to le/t

    instanceo/ 9y0es $one

    \ Logical not ight to le/t

    1 M3lti0lication1di8ision1mod3l3s Le/t to right

    Y % 2 >ddition1s3btraction1string

    concatenation

    Le/t to right

    F E EF E 4om0arison $one

    FF \F FFF \FF !?3ality $one

    ]] Logical >nd Le/t to right

    ^^ Logical Ar Le/t to right

    6 4onditional o0erator Le/t to right

    F YF %F F 1F F 2F >ssignment statements ight to le/t

    >$D Logical >nd Le/t to right

    :A Logical !7cl3si8e Ar Le/t to right

    A Logical Ar Le/t to right

    , List se0arator Le/t to right

    e/erence htt011www20h02net1man3al1en1lang3age2o0erators20recedence20h0

    http://www.php.net/manual/en/language.operators.precedence.phphttp://www.php.net/manual/en/language.operators.precedence.php
  • 8/11/2019 Php Mysql Chapter_01

    26/44

    Sam0le Programs

    cha0ter&&20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJEheadE\%% PHP cha0ter &

    >3thor Hans ;i0Date +1C+1C&

    %%EtitleEPHP 4ha0ter &1titleE1headEbodyEh&E4ha0ter & % /o3r ty0es o/ code declaration blocks1h&E

    0E60h0echo J9his te7t is 0rinted 3sing standard PHP scri0t delimiters2JB6E10E

    0Escri0t lang3ageFJ0h0JEecho J9his te7t is 0rinted 3sing a PHP scri0t section2JB1scri0tE

    10E

    0E6echo J9his te7t is 0rinted 3sing short PHP scri0t delimiters2JB6E10E

    0Eecho J9his te7t is 0rinted 3sing >SP%style scri0t delimiters2JB

    E10E

    1bodyE1htmlE

  • 8/11/2019 Php Mysql Chapter_01

    27/44

  • 8/11/2019 Php Mysql Chapter_01

    28/44

    cha0ter&'20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJE

    headE\%% PHP cha0ter & "nteger 3thor Hans ;i0Date &1C1C&

    %%EtitleEPHP 4ha0ter & % "nteger ]

  • 8/11/2019 Php Mysql Chapter_01

    29/44

  • 8/11/2019 Php Mysql Chapter_01

    30/44

    cha0ter&-20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJE

    headE\%% PHP cha0ter & >rray>3thor Hans ;i0Date &1C1C&

    %%EtitleEPHP 4ha0ter & % >rray1titleE1headEbodyEh&E4ha0ter & % >rray1h&E60h0UMy>rray F array(JdataJ, Jdata&J, JdataCJ)B

    UHoteleser8ation F array(JMy $ameJ, 11 g3est name (string)C, 11 R o/ nights (integer)+2-, 11 0rice 0er night (/loating%0oint)tr3e)B 11 nonsmoking room (#oolean)

    UMy>rrayN F Jdata'JBUMy>rrayN F Jdata.JBUMy>rrayN F Jdata-JB

    1 to /ind the total n3mber o/ elements in an array, 3se the co3nt() /3nction2 1echo J0E$3mber o/ elements in My>rray J, co3nt(UMy>rray), Jbr 1EJ,J$3mber o/ elements in Hoteleser8ation array J, co3nt(UHoteleser8ation), J10EJB

    echo J0E9here are J, co3nt(UMy>rray), J elements in My>rray21PE0EJBecho JUMy>rrayNbr 1EJBecho JUMy>rray&Nbr 1EJBecho JUMy>rrayCNbr 1EJBecho JUMy>rray'Nbr 1EJBecho JUMy>rray.Nbr 1EJBecho JUMy>rray-N10EJB

    1 Modi/ying elements 1UMy>rrayCN F JMore dataJBUMy>rray&N F JLess dataJB

    1 3se 0rintr(), 8are70ort(), and 8ard3m0() /3nctions 1echo J0E0reEJB0rintr(UMy>rray)B

  • 8/11/2019 Php Mysql Chapter_01

    31/44

    echo J10reE10EJB

    echo J0E0reEJB8are70ort(UMy>rray)Becho J10reE10EJB

    echo J0E0reEJB8ard3m0(UMy>rray)Becho J10reE10EJB

    1 3se 0rintr(), 8are70ort(), and 8ard3m0() /3nctions in 8ariable1UMyData F JHelloJBecho J0E0reEJB0rintr(UMyData)Becho J10reE10EJB

    echo J0E0reEJB8are70ort(UMyData)Becho J10reE10EJB

    echo J0E0reEJB8ard3m0(UMyData)Becho J10reE10EJB

    UMy$3m F 'Becho J0E0reEJB0rintr(UMy$3m)Becho J10reE10EJB

    echo J0E0reEJB8are70ort(UMy$3m)Becho J10reE10EJB

    echo J0E0reEJB8ard3m0(UMy$3m)Becho J10reE10EJB

    UMy#oolean9r3e F tr3eBecho J0E0reEJB0rintr(UMy#oolean9r3e)Becho J10reE10EJB

    echo J0E0reEJB8are70ort(UMy#oolean9r3e)Becho J10reE10EJB

  • 8/11/2019 Php Mysql Chapter_01

    32/44

    echo J0E0reEJB8ard3m0(UMy#oolean9r3e)Becho J10reE10EJB

    UMy#oolean

  • 8/11/2019 Php Mysql Chapter_01

    33/44

    cha0ter&V20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJE

    headE\%% PHP cha0ter & >rithmetic #inary A0erators>3thor Hans ;i0Date &1C1C&

    %%EtitleEPHP 4ha0ter & % >rithmetic #inary A0erators1titleE1headEbodyEh&E4ha0ter & % >rithmetic #inary A0erators1h&E60h011 >DD"9"A$

    U7 F &BUy F CBUet3rnTal3e F U7 Y UyBecho J0Eet3rnTal3e a/ter addition e70ression J, Uet3rnTal3e, J10EJB

    11 S#9>49"A$U7 F &BUy F *BUet3rnTal3e F U7 % UyBecho J0Eet3rnTal3e a/ter s3btraction e70ression J, Uet3rnTal3e, J10EJB

    11 ML9"PL"4>9"A$U7 F CBUy F VBUet3rnTal3e F U7 UyBecho J0Eet3rnTal3e a/ter m3lti0lication e70ression J, Uet3rnTal3e, J10EJB

    11 D"T"S"A$U7 F C.BUy F 'BUet3rnTal3e F U7 1 UyBecho J0Eet3rnTal3e a/ter di8ision e70ression J, Uet3rnTal3e, J10EJB

    11 MADLSU7 F 'BUy F CBUet3rnTal3e F U7 UyBecho J0Eet3rnTal3e a/ter mod3l3s e70ression J, Uet3rnTal3e, J10EJB

    11 4on8ert string to n3mbers

  • 8/11/2019 Php Mysql Chapter_01

    34/44

    U7 F JCJBUy F J'JBUet3rnTal3e F U7 UyBecho J0Eet3rnTal3e a/ter being con8erted to n3mber and 0er/orm m3lit0licatione70ression J, Uet3rnTal3e, J10EJB

    11 4on8ert string to n3mber, one is not a n3mberU7 F JCJBUy F Jabc'JBUet3rnTal3e F U7 UyBecho J0Eet3rnTal3e with one non n3mber string and 0er/orm m3lit0licatione70ression J, Uet3rnTal3e, J10EJB

    6E1bodyE

    1htmlE

  • 8/11/2019 Php Mysql Chapter_01

    35/44

    cha0ter&*20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJE

    headE\%% PHP cha0ter & >rithmetic nary A0erators>3thor Hans ;i0Date &1C1C&

    %%EtitleEPHP 4ha0ter & % >rithmetic nary A0erators1titleE1headEbodyEh&E4ha0ter & % >rithmetic nary A0erators1h&E60h011 Pre/i7 increment

    U7 F VBUy F Becho J0ETal3e o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJBUy F YYU7Becho J0Ees3lt a/ter Pre/i7 increment o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJB11 Post/i7 incrementUy F U7YYBecho J0Ees3lt a/ter Post/i7 increment o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJB

    11 Pre/i7 decrementUy F %%U7Becho J0Ees3lt a/ter Pre/i7 decrement o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJB11 Post/i7 decrementUy F U7%%Becho J0Ees3lt a/ter Post/i7 decrement o/ 7 J, U7, J Tal3e o/ y J, Uy, J10EJB

    6E1bodyE1htmlE

  • 8/11/2019 Php Mysql Chapter_01

    36/44

    cha0ter&+20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJE

    headE\%% PHP cha0ter & >rithmetic >ssignment A0erators>3thor Hans ;i0Date &1C1C&

    %%EtitleEPHP 4ha0ter & % >rithmetic >ssignment A0erators1titleE1headEbodyEh&E4ha0ter & % >rithmetic >ssignment A0erators1h&E60h011 >ssignment and com0o3nd addition assignment

    echo J0EJBU7 F &BUy F CBU7 YF UyBecho U7, Jbr 1EJB11 4om0o3nd s3btraction assignmentU7 F &BUy F *BU7 %F UyBecho U7, Jbr 1EJB

    11 4om0o3nd m3lti0lication assignmentU7 F CBUy F VBU7 F UyBecho U7, Jbr 1EJB

    11 4om0o3nd di8ision assignmentU7 F C.BUy F 'BU7 1F UyBecho U7, Jbr 1EJB

    11 4om0o3nd mod3l3s assignmentU7 F 'BUy F CBU7 F UyBecho U7, J10EJB

  • 8/11/2019 Php Mysql Chapter_01

    37/44

    6E1bodyE1htmlE

  • 8/11/2019 Php Mysql Chapter_01

    38/44

    cha0ter&20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJE

    headE\%% PHP cha0ter & 4om0arison and 4onditional A0erators>3thor Hans ;i0Date &1C1C&

    %%EtitleEPHP 4ha0ter & % 4om0arison and 4onditional A0erators1titleE1headEbodyEh&E4ha0ter & % 4om0arison and 4onditional A0erators1h&E60h0

    UTal3e& F J/irst te7t stringJBUTal3eC F Jsecond te7t stringJBUet3rnTal3e F (UTal3e& FF UTal3eC 6 Jtr3eJ J/alseJ)Becho J0EJBecho JTal3e& F UTal3e&, Tal3eC F UTal3eC br 1Ebr 1EJBecho OUTal3e& e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1E10EJB

    UTal3e& F -BUTal3eC F *-Becho J0EJBecho JTal3e& F UTal3e&, Tal3eC F UTal3eC br 1Ebr 1EJBUet3rnTal3e F (UTal3e& FF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& \F UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& not e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& E UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& E not e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& E UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& greater than UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& EF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& greater than e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& less than UTal3eC O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& F UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& less than or e?3al to UTal3eC O, Uet3rnTal3e, Jbr 1E10EJB

    UTal3e& F C-BUTal3eC F C-Becho J0EJBecho JTal3e& F UTal3e&, Tal3eC F UTal3eC br 1Ebr 1EJB

  • 8/11/2019 Php Mysql Chapter_01

    39/44

    Uet3rnTal3e F (UTal3e& FFF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& strictly e?3al to UTal3eC and the same data ty0e O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& \FF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& not strictly e?3al to UTal3eC or not the same data ty0e O, Uet3rnTal3e,Jbr 1E10EJB

    UTal3e& F &BUTal3eC F J&JBecho J0EJBecho JTal3e& F UTal3e&, Tal3eC F UTal3eC br 1Ebr 1EJBUet3rnTal3e F (UTal3e& FFF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& strictly e?3al to UTal3eC and the same data ty0e O, Uet3rnTal3e, Jbr 1EJBUet3rnTal3e F (UTal3e& \FF UTal3eC 6 Jtr3eJ J/alseJ)Becho OUTal3e& not strictly e?3al to UTal3eC or not the same data ty0e O, Uet3rnTal3e,Jbr 1EJBecho J10EJB

    6E1bodyE1htmlE

  • 8/11/2019 Php Mysql Chapter_01

    40/44

    cha0ter&&20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJE

    headE\%% PHP cha0ter & Logical A0erators>3thor Hans ;i0Date &1C1C&

    %%EtitleEPHP 4ha0ter & % Logical A0erators1titleE1headEbodyEh&E4ha0ter & % Logical A0erators1h&E60h011 >nd o0erator (]] >$D and)

    UGender F JmaleJBU>ge F C+BUiskge F C&B 11 ret3rns LS!i/ (Uisk

  • 8/11/2019 Php Mysql Chapter_01

    41/44

  • 8/11/2019 Php Mysql Chapter_01

    42/44

    cha0ter&&&20h0N

    \DA49;P! html P#L"4 J%115'411D9D :H9ML &2 9ransitional11!$JJhtt011www2w'2org1917html&1D9D17html&%transitional2dtdJEhtml 7mlnsFJhtt011www2w'2org1&17htmlJE

    headE\%% PHP cha0ter & 9y0e 4asting>3thor Hans ;i0Date &1C1C&

    %%EtitleEPHP 4ha0ter & % 9y0e 4asting1titleE1headEbodyEh&E4ha0ter & % 9y0e 4asting1h&E60h0

    U$3mString F JC' milesJBUes3lt F U$3mString CBecho J0EArignal data U$3mString, es3lt Ues3lt10EJB

    UString$3m F Jan C' milesJBUes3lt F UString$3m CBecho J0EArignal data UString$3m, es3lt Ues3lt10EJB

    UData F VCBecho J0EAriginal data UDatabr 1EJBecho getty0e(UData), Jbr 1EJBecho J4asting do3ble J, getty0e((do3ble)UData), Jbr 1EJBecho J4asting string J, getty0e((string)UData), Jbr 1EJBecho J4asting boolean J, getty0e((boolean)UData), Jbr 1EJB

    Ues3lt F ((boolean) UData)6 J9r3eJ J

  • 8/11/2019 Php Mysql Chapter_01

    43/44

    UData F JJBUes3lt F ((boolean) UData)6 J9r3eJ J

  • 8/11/2019 Php Mysql Chapter_01

    44/44

    Ues3lt F (isstring(UData))6 J9r3eJ J


Recommended