Multiple explode cutting and combination, what should be done?

Source: Internet
Author: User
$a = ' youku$$ $tudou $$ $down '
$b = ' first episode $ABCD
First episode $ABCD
Second episode $ABCD
Episode III $ABCD
Fourth episode $ABCD
Fifth episode $abcd$$$ first episode $ABCD
First episode $ABCD
Second episode $ABCD
Episode III $ABCD
Fourth episode $ABCD
Fifth episode $abcd$$$ first episode $ABCD
First episode $ABCD
Second episode $ABCD
Episode III $ABCD
Fourth episode $ABCD
Fifth episode $ABCD '



It's all $$$ division correspondence.
Last $ or line break split
Finally need to get
  • Youku

  • First episode
    Second episode
    Third episode
    Fourth episode
    Fifth episode

  • Tudou

  • First episode
    Second episode
    Third episode
    Fourth episode
    Fifth episode

  • Down

  • First episode
    Second episode
    Third episode
    Fourth episode
    Fifth episode


    Reply to discussion (solution)

    $a = ' youku$$ $tudou $$ $down '; $b = ' first episode $ABCD first episode $ABCD second episode $abcd third $ABCD fourth episode $ABCD fifth episode $abcd$$$ first episode $ABCD first episode $ABCD second episode $ABCD third episode $ ABCD Fourth Episode $ABCD fifth episode $abcd$$$ first episode $ABCD first episode $ABCD the second episode $ABCD the third episode $ABCD fourth episode $ABCD fifth set $ABCD '; $a = explode (' $$$ ', $a); $b = explode (' $$$ ') , $b), foreach ($a as $i = + $r) {  echo "
  • $r
  • \ n "; foreach (Explode ("\ n", $b [$i]) as $v) { $t = explode (' $ ', trim ($v)); echo "$t [0]\n"; }}
  • Youku
  • First episode Episode II episode fourth episode fifth episode
  • Tudou
  • First episode Episode II episode fourth episode fifth episode
  • Down
  • First episode Episode II episode fourth episode fifth episode

    The hyperlink output is wrong.

    $a = ' youku$$ $tudou $$ $down '; $b = ' first episode $ABCD first episode $ABCD second episode $abcd third $ABCD fourth episode $ABCD fifth episode $abcd$$$ first episode $ABCD first episode $ABCD second episode $ABCD third episode $ ABCD Fourth Episode $ABCD fifth episode $abcd$$$ first episode $ABCD first episode $ABCD the second episode $ABCD the third episode $ABCD fourth episode $ABCD fifth set $ABCD '; $a = explode (' $$$ ', $a); $b = explode (' $$$ ') , $b), foreach ($a as $i = + $r) {  echo "
  • $r
  • \ n "; foreach (Explode ("\ n", $b [$i]) as $v) { $t = explode (' $ ', trim ($v)); echo "$t [0]\n"; }}
  • Youku
  • First episode Episode II episode fourth episode fifth episode
  • Tudou
  • First episode Episode II episode fourth episode fifth episode
  • Down
  • First episode Episode II episode fourth episode fifth episode

    Wrong? Where is it wrong?
    I can't get out of it, can I?

    The hyperlink should be
    Youku
    1_1.html
    1_2.html
    1_3.html
    ``````````

    Tudou
    2_1.html
    2_2.html
    2_3.html
    ```````````

    Down
    3_1.html
    3_2.html
    3_3.html
    `````````

    Multiple loops output I don't know what to do.

    Wrong? Where is it wrong?
    I can't get out of it, can I?

    The page should be real and should be filled in the ABCD location of your data
    How can the dynamically generated and real pages correspond?

    *_*.html
    (Here is an array of Youku Tudou down) _ (here is the ID of each group and re-corresponds). html

    Change to this, the link name is wrong, the array of hyperlinks can start from 1, not from 0?


    $a = ' youku$$ $tudou $$ $down '; $b = ' first episode $ABCD first episode $ABCD second episode $abcd third episode $abcd fourth episode $ABCD fifth episode $abcd$$$ sixth episode $ABCD seventh set $ABCD eighth set $DDDDD Nineth set $ ABCD Tenth Episode $ABCD 11th episode $abcd$$$ 12th episode $ABCD 13th set $ABCD 14th set $ABCD 15th set $ABCD 16th set $ABCD 17th set $efghijk '; $a = explode (' $$$ ', $a); $b = Explode (' $$$ ', $b); foreach ($a as $i = + $r) {  echo]
  • $r
  • \ n "; foreach (Explode ("\ n", $b [$i]) as $v = = $lala) { $t = explode (' $ ', trim ($v)); echo "$t [0]\n"; }}




    The page should be real and should be filled in the ABCD location of your data
    How can the dynamically generated and real pages correspond?

    $a = explode (' $$$ ', $a), $b = explode (' $$$ ', $b), foreach ($a as $i + = $r) {  echo "
  • $r
  • \ n "; foreach (Explode ("\ n", $b [$i]) as $j = = $v) { $t = explode (' $ ', trim ($v)); printf ("%s\n", $i +1, $j +1, $t [0]);} }
  • Youku
  • First episode Episode II episode fourth episode fifth episode
  • Tudou
  • First episode Episode II episode fourth episode fifth episode
  • Down
  • First episode Episode II episode fourth episode fifth episode


    But your data is supposed to be like this.
    $a = ' youku$$ $tudou $$ $down '; $b = ' first episode $1_1.html second episode $1_2.html third episode $1_3.html fourth episode $1_3.html fifth episode $1_5.html$$$ first episode $2_1.html second episode _2.html Third Episode $2_3.html fourth episode $2_4.html fifth episode $2_5.html$$$ the first episode $3_1.html the second episode $3_2.html the third episode $3_3.html fourth episode $3_4.html fifth set $3_5.html '; $a = explode (' $$$ ', $a), $b = explode (' $$$ ', $b), foreach ($a as $i + = $r) {  echo "
  • $r
  • \ n "; foreach (Explode ("\ n", $b [$i]) as $v) { $t = explode (' $ ', trim ($v)); echo "$t [0]\n"; }}
  • Youku
  • Episode two, episode fourth, episode fifth
  • Tudou
  • Episode two, episode fourth, episode fifth
  • Down
  • Episode two, episode fourth, episode fifth

    Thank you so much

    In fact, this is a play address, ABCD is the playback address, to do it with another

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.