It is too troublesome to use this method to write arrays.

Source: Internet
Author: User
Writing arrays in this way is too troublesome. please advise me on the php I recently learned. don't laugh at me... How to write the following code using multi-dimensional arrays? Or a loop or something like this. if there are one hundred sets in this method, I will write it to one hundred. although it can be used, it is quite troublesome. who can help me streamline IT? thank you !. & Lt ;? Writing arrays in this way is too troublesome. please advise
I am studying PHP temporarily today. don't laugh at me...
How to write the following code using multi-dimensional arrays? Or a loop or something like this. if there are one hundred sets in this method, I will write it to one hundred. although it can be used, it is quite troublesome. who can help me streamline IT? thank you !.
 $ Str = 'bdhd: // 200901671 | d772d8e1024f0fd8e0108b0ea780232e | happy Ferris wheel [DVD Mandarin] 01. rmvb
Bdhd: // 291075915 | D522381AF3E6F7E0F563AD4EFA10D0CE | happy Ferris wheel Mandarin version 02. rmvb
Bdhd: // 298891909 | 497E7DED0EBFDAA6A8FAB4090F188F5E | happy Ferris wheel Mandarin Version 03. rmvb
Bdhd: // 301745786 | E81EF94B221952ABA26364AC5DA84B67 | happy Ferris wheel Mandarin 04. rmvb
Bdhd: // 176465436 | 40F28A77D5EED5C5B7DDF3A3AFADC15C | happy Ferris wheel Mandarin version 05. rmvb
Bdhd: // 300390984 | ACEA3118EB814D9167DF0F27289E82D6 | happy Ferris wheel Mandarin Edition 06. rmvb
Bdhd: // 298343800 | C9CCF7BA67F7DA14D754A992DD8F6A37 | happy Ferris wheel Mandarin Edition 07. rmvb
Bdhd: // 200661628 | 281605707686E6E57E6C08FC28314B22 | happy Ferris wheel [DVD Mandarin] 08. rmvb
Bdhd: // 201050238 | CDAEC0AD4A6F7A4748C18C305D4D832D | happy Ferris wheel [DVD Mandarin] 09. rmvb
Bdhd: // 192036005 | 7DA1F0052A9AF2D69C8132EF9F9C0EAD | happy Ferris wheel Mandarin Edition 10. rmvb
Bdhd: // 192961337 | 35921C5F22111A5AA9A39CCC26AB75B6 | happy Ferris wheel Mandarin version 11. rmvb
Bdhd: // 282339636 | 7743DB068D199F2E6EB921BBAEE99FBF | happy Ferris wheel Mandarin version 12. rmvb
Bdhd: // 326028524 | 6893BB04B5C76D8396611376ED5253CE | happy Ferris wheel Cantonese 13.hdtv.mp4
Bdhd: // 329388655 | A0723D41A65E44F2A5EE8CC2DFDF4F23 | happy Ferris wheel Guangdong 14_hdtv.mp4 ';
$ Exp = explode ("\ r \ n", $ str );
$ A0 = $ exp [0];
$ A1 = $ exp [1];
$ A2 = $ exp [2];
$ A3 = $ exp [3];
$ A4 = $ exp [4];
$ A5 = $ exp [5];
$ A6 = $ exp [6];
$ A7 = $ exp [7];
$ A8 = $ exp [8];
$ A9 = $ exp [9];
$ A10 = $ exp [10];
$ A11 = $ exp [11];
$ A12 = $ exp [12];
$ A13 = $ exp [13];
$ A14 = $ exp [14];
$ A15 = $ exp [15];
$ A16 = $ exp [16];
$ A17 = $ exp [17];
$ A18 = $ exp [18];
$ A19 = $ exp [19];
$ A20 = $ exp [20];
$ A21 = $ exp [21];
$ A22 = $ exp [22];
$ A23 = $ exp [23];
$ A24 = $ exp [24];
$ A25 = $ exp [25];
$ A26 = $ exp [26];
$ A27 = $ exp [27];
$ A28 = $ exp [28];
$ A29 = $ exp [29];
$ A30 = $ exp [30];
$ A31 = $ exp [31];
$ A32 = $ exp [32];
$ A33 = $ exp [33];
$ A34 = $ exp [34];
$ A35 = $ exp [35];
$ A36 = $ exp [36];
$ A37 = $ exp [37];
$ A38 = $ exp [38];
$ A39 = $ exp [39];
$ A40 = $ exp [40];
$ A41 = $ exp [41];
$ A42 = $ exp [42];
$ A43 = $ exp [43];
$ A44 = $ exp [44];
$ A45 = $ exp [45];
$ A46 = $ exp [46];
$ A47 = $ exp [47];
$ A48 = $ exp [48];
If (empty ($ a0) echo "";
Else
Echo 'Episode 1 ';
If (empty ($ a1) echo "";
Else
Echo 'second set ';
If (empty ($ a2) echo "";
Else
Echo 'Episode 3 ';
If (empty ($ a3) echo "";
Else
Echo 'fourth set ';
If (empty ($ a4) echo "";
Else
Echo 'fifth set ';
If (empty ($ a5) echo "";
Else
Echo 'Episode 6 ';
If (empty ($ a6) echo "";
Else
Echo '7th set ';
If (empty ($ a7) echo "";
Else
Echo 'Episode 8 ';
If (empty ($ a8) echo "";
Else
Echo 'Episode 9 ';
If (empty ($ a9) echo "";
Else
Echo 'Episode 10 ';
If (empty ($ a10) echo "";
Else
Echo 'Episode 10 ';
?>

------ Solution --------------------

// Connect $ str = "...";
$ Exp = explode ("\ n", $ str );

// It is difficult to convert the number to a Chinese representation, and it is inefficient. If this function is not affected, you do not need this function.
Function num2str ($ num)
{
$ Cns = array ('0', 'yi', '2', '3', '4', '5', '6', '7 ', '8', '9', '10'

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.