PHP düzenli ifade preg_match'in

0 Cevap php
$var = '<lang test=<php>string</php>><lang test2=before<php>inside</php>>'.
       '<lang test3=THIRD_WITHOUT_PHP_TAGS><lang test4>';
if (preg_match_all('#<lang (.*?)>#', $var, $gg))
{
    var_dump($gg[1]);
}

Ben dökümü almak:

array(2) {
  [0]=>
  string(9) "test=<php"
  [1]=>
  string(16) "test2=before<php"
}

Ama ben almak istiyorum:

test=<php>string</php>

ve

test2=before<php>inside</php>

ve

test3=THIRD_WITHOUT_PHP_TAGS

ve

test4

Nasıl yapılacak?

EDIT: I CHANGE THE $var AND ADD third expression

EDIT 2: ADEED the fourth expression without "="

0 Cevap