Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] Regular Expressions - instrukcje warunkowe
PiratNowegoPokol...
post 19.03.2007, 17:00:40
Post #1





Grupa: Zarejestrowani
Postów: 132
Pomógł: 0
Dołączył: 12.10.2006

Ostrzeżenie: (0%)
-----


Witam blinksmiley.gif

  1. <?php
  2. $sRegExpression2 = '|<!-- startIf('. $m[1] .') -->(.*?)(<!-- elseIf(( ?[^)]+ ?)) -->(.*?))*<!-- endIf -->|si';
  3. preg_match_all( $sRegExpression2 , $sBody , $m2 );
  4. print_r( $m2 );
  5. ?>


na

Kod
<!-- startIf( s = true ) -->
asdasd
<!-- elseIf( s ) -->
asd
<!-- elseIf( s = truea ) -->
asd
<!-- endIf -->


wyświetla

Kod
Array
(
    [0] => Array
        (
            [0] => <!-- startIf( s = true ) -->
asdasd
<!-- elseIf( s ) -->
asd
<!-- elseIf( s = truea ) -->
asd
<!-- endIf -->
        )

    [1] => Array
        (
            [0] =>
asdasd

        )

    [2] => Array
        (
            [0] => <!-- elseIf( s = truea ) -->
asd

        )

    [3] => Array
        (
            [0] =>  s = truea
        )

    [4] => Array
        (
            [0] =>
asd

        )

)


Chciałbym się dowiedzieć gdzie mi zgineło :""<!-- elseIf( s ) -->asd" ... i dlaczego tak się stało ...
rolleyes.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 28.06.2025 - 15:00