Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

If I have an array:

Array
(
    [0] => Array
        (
            [0] => |174|September|2001| 
            [1] => |Pengantar=Hello!!!!
            [2] => |Tema= Sami Mawon 
            [3] => |Tema_isi=meet you!!!
            [4] => |Kutip=people
            [5] => |Kutip_kitab=Efesus
            [6] => |Kutip_pasal=4
            [7] => |Kutip_ayat=28
            [8] => |Tema_sumber=Kiriman dari Maurits albert (romind@ )
            [9] => [[Kategori:e-humor 2001]]
        ) 

How can I get the value of Pengantar, Tema, Tema_isi etc?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
202 views
Welcome To Ask or Share your Answers For Others

1 Answer

You're going to have to loop over the array and use preg_match with a reference. Regex something like this (off the top of my head) would probably work:

/|(.*?)=(.*?)|?/

Just use preg_match('/|(.*?)=(.*?)|?/', $subject[$x], $matches); and var_dump($matches); to see the results.

Don't forget that the $matches array passed into the preg_match function is a reference to an array which you should instantiate first and that it will be overwritten in each loop cycle.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...