The following is a partial processing of source code
]*?> ' si ', ' ", $exam); $exam = Preg_replace ("'
]*?> ' si ', ' ", $exam); $exam = Preg_replace ("'
]*?> ' si", "", $exam); $exam = Str_replace ("", "{tr}", $exam); $exam = Str_replace ("", "{td}", $exam); Remove HTML Markup $exam = Preg_replace ("' <[/!") *? [^<>]*?> ' si ', ' ", $exam); Remove whitespace characters $exam = preg_replace ("' ([RN]) [s]+ '", "", $exam); $exam = Preg_replace ('//', "", $exam); $exam = Str_replace ("", "" ", $exam); $exam = Str_replace ("", "" ", $exam); $exam = Explode (' {tr} ', $exam); Array_pop ($exam); Print_r ($exam);? >
What I want is to take out the following piece of data into the array, do not know how to write, the first contact with the regular feel do not understand, thank you to the great gods!
[+] = + Number {TD} course {TD} date {TD} TIME {TD} class {TD} Test room {td} Instructor {TD}[20] = 1{td} fluid Dynamics {td}2014-11-0600:00:00.0{td}14:00-16:00 {TD} Civil 122{TD}Ⅲ-209{TD} Sinina {TD}
Reply to discussion (solution)
That's what you're going to do.
Print_r (Array_map (NULL, explode (' {TD} ', $exam []), explode (' {TD} ', $exam [20]));
Array ([ 0] = = Array ( [0] = = number [1] = 1 ) [1] = = Array ( [0] + = Course [ 1] = Fluid mechanics ) [2] = = Array ( [0] = = Date [1] = = 2014-11-0600:00:00.0 ) [3] = > Array ( [0] = time [1] = + ) [4] = = Array ( [0] = Class [1] = = Civil 122 ) [5] = = Array ( [0] = examination room [1] =>ⅲ-209 ) [6] = = Array ( [0] + = Instructor
[1] = Sinina ) [7] = = Array ([0] = = [1] = =) )
It's still like that.
Print_r (Array_combine (Explode (' {TD} ', $exam []), explode (' {TD} ', $exam [20]));
Array ( [number] = 1 [Course] = Fluid mechanics [Date] = 2014-11-0600:00:00.0 [TIME] [class] = > Civil 122 [examination Room] =>ⅲ-209 [Instructor] = Sinina [] =
I think it's the second one. Insert into the template as an array variable thank you, great God.
Moderator, can I ask you a small question? [Date] = 2014-11-0600:00:00.0 This data on the page is not 00:00:00.0 these, can be removed?
$s = ' 2014-11-0600:00:00.0 '; Echo date (' y-m-d ', strtotime ($s)); Echo substr ($s, 0, 10);
Both of these methods can be
Thank you moderator, so dedicated, grateful extremely, this paste end!