ASK preg_match

Discussion in 'Desain Web dan Programming' started by Indodata, 16 Nov 2015.

Thread Status:
Not open for further replies.
  1. Indodata

    Indodata Apprentice 1.0

    Messages:
    325
    Likes Received:
    35
    Trophy Points:
    28
    Halo mas
    Mau tanya mengenai preg_match ni
    $kata "makan:id:[dinamis],nama:[dinamis],minum[dinamis]
    example
    $kata = "makan:id:1,nama:nasi goreng,minum:teh";

    nah saya mau nanya ni, gmana nampilin (nasi goreng), (teh) dengan menggunakan preg_match?

    makasih sebelumnya :D
     
  2. indra

    indra Apprentice 2.0

    Messages:
    567
    Likes Received:
    29
    Trophy Points:
    28
    boleh dicoba
    PHP:
    $pattern '/makan:id:1,nama:([a-zA-Z0-9 ]+),minum:([a-zA-Z0-9 ]+)/';
    $subject 'makan:id:1,nama:nasi goreng,minum:teh';
    $result preg_match ($pattern$subject, [], PREG_OFFSET_CAPTURE);
     
Thread Status:
Not open for further replies.

Share This Page

Loading...