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

    preg_match dlm php

    avatar
    jesseclane
    Ahli Baharu
    Ahli Baharu


    Number of posts : 9
    Registration date : 23/04/2009

    preg_match dlm php Empty preg_match dlm php

    Post by jesseclane Tue Apr 28, 2009 8:00 am

    $text = "<td width='15%'>Nerve:</td><td width='35%'>2 / 8 [25%]</td>"

    soklan

    cmne nk dptkan value 2 (yang diboldkan) tu? xpandai lagi dengan preg_match.. jauh sangat dengan Nerve: tuh.. huhu..

    sapa2 leh tlg.. tQ!
    avatar
    SHiDi
    Ahli Baharu
    Ahli Baharu


    Gender : Male Number of posts : 30
    Age : 39
    Location : Ampang
    Job/hobbies : Geek
    Registration date : 03/03/2009

    preg_match dlm php Empty Re: preg_match dlm php

    Post by SHiDi Tue Apr 28, 2009 4:51 pm

    Kenapa pilih nak guna preg_match? Memang akan sentiasa cari nilai 2 ke?
    avatar
    jesseclane
    Ahli Baharu
    Ahli Baharu


    Number of posts : 9
    Registration date : 23/04/2009

    preg_match dlm php Empty Re: preg_match dlm php

    Post by jesseclane Tue Apr 28, 2009 5:16 pm

    nk pilih value diantara string aku selalu gune preg_match.. tp masalahnye dlm string tu ada byk tag cth : </td>.. bile masuk dlm preg_match() nnt dier tulis /t unknown apa tah
    avatar
    XShimeX
    Ahli Baharu
    Ahli Baharu


    Number of posts : 2
    Registration date : 22/03/2009

    preg_match dlm php Empty Re: preg_match dlm php

    Post by XShimeX Sat May 02, 2009 12:52 am

    Code:
    <?php

    $text = "<td width='15%'>Nerve:</td><td width='35%'>2 / 8 [25%]</td>";

    if((preg_match("/<td width='35%'>(.*?)<\/td>/", $text, $result))) {
       echo $result[0];
    } else {
       echo "Text tidak dapat di cari!";
    }


    ?>

    Sponsored content


    preg_match dlm php Empty Re: preg_match dlm php

    Post by Sponsored content


      Current date/time is Fri Mar 29, 2024 12:51 am