Forum Sementara Putera.com

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Forum Sementara Putera.com

Bersama kita perkemaskan forum ini sementara forum asal dalam pemulihan.

Forum putera dah kembali. Masalah sudah berjaya diselesaikan. Sila lawati http://forum.putera.com/tanya


3 posters

    Apa fungsi tanda2 : & , @ , <?=

    kluanggirl
    kluanggirl
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 25
    Location : Dok Duane2 ah
    Registration date : 18/07/2009

    Apa fungsi tanda2 : & , @ , <?= Empty Apa fungsi tanda2 : & , @ , <?=

    Post by kluanggirl Sat Jan 16, 2010 1:41 pm

    Apa fungsi tanda2 : & , @ , <?=

    Aku ada byk soalan nie..Harap ada laa..yg sudi nak jawap. Aku bukan apa, tak pernah guna tanda2 nie tapi jadi jugak script...tu yg musykil tu.

    contoh kod 1:
    <?php
    $host = ' ';
    $user = ' ';
    $pass = ' ';
    $name = ' ';
    $db = & new MySQL($host,$user,$pass,$name);
    ?>
    Apa fungsi tanda & sebelum new tu??


    contoh kod 2:
    // Make connection to MySQL server
    if (!$this->dbConn = @mysql_connect($this->host,
    $this->dbUser,
    $this->dbPass)
    Apa fungsi tanda @?


    <script type=javascript>

    var xy='<?= echo $zz; ?>';
    </script>

    Kenapa nak kena letak tanda '=' selepas <?

    drunken
    avatar
    BasicCX
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 230
    Registration date : 25/02/2009

    Apa fungsi tanda2 : & , @ , <?= Empty Re: Apa fungsi tanda2 : & , @ , <?=

    Post by BasicCX Sat Jan 16, 2010 2:11 pm

    Apa fungsi tanda & sebelum new tu??

    Bila letak "&" pada variable ia dinamakan objek. Jadi kita biasanya guna &new untuk panggil objek yang dimasudkan.


    Apa fungsi tanda @?

    Simbol "@" menandakan variable tu ada pool of data.


    Kenapa nak kena letak tanda '=' selepas <?

    Yang ni pulak tak pernah jumpa. Biasanya "<?" sahaja sudah memadai.
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    Apa fungsi tanda2 : & , @ , <?= Empty Re: Apa fungsi tanda2 : & , @ , <?=

    Post by johnburn Sat Jan 16, 2010 2:29 pm

    & dlam kod yg pertama tu bermaksud reference so $db akan refer kpd class MYSQL. Bleh rjuk penggunaan OO dlm PHP:
    http://www.php.net/manual/en/language.oop5.php

    penggunaan @ di dpn mane2 function akan suppress error yg mungkin dikeluarkan php ketika memanggil funtion tersebut. Ini untk mngelakkn user tgk error kl berlaku kesilapan dlm code

    <? merupakan short tag/shorthand. kene pastikan short_open_tag dh on dulu dlm php configuration (php.ini). <?= sama maksud dgn <? echo so spttnye xyah ltak echo dh dlm cnth code ko tuh.
    kluanggirl
    kluanggirl
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 25
    Location : Dok Duane2 ah
    Registration date : 18/07/2009

    Apa fungsi tanda2 : & , @ , <?= Empty Re: Apa fungsi tanda2 : & , @ , <?=

    Post by kluanggirl Sat Jan 16, 2010 6:52 pm

    <script type=javascript>

    var xy='<?= echo $zz; ?>';
    </script>

    aku reka sendiri kod ni tak tahu pulak salah..Smile

    Thanks

    Sponsored content


    Apa fungsi tanda2 : & , @ , <?= Empty Re: Apa fungsi tanda2 : & , @ , <?=

    Post by Sponsored content


      Current date/time is Fri May 10, 2024 11:30 am