preg_match_all tek maç dönen

0 Cevap php

Ben bir PHP acemi değilim. Ben onların işaretleri ile tüm konuları bulmak için aşağıdaki programda preg_match_all işlevini kullanmaya çalışıyorum, ama ben sadece one maçı alıyorum. Ben 5 saat boyunca bu ile mücadele edilmiştir. Birisi ne yanlış bulmaktan bana yardımcı olabilir misiniz? Şimdiden teşekkürler.

<?php
$semArray="<B>STUDENTS NAME (7ab05cs001) </B><br><br><br><br><hr><table><tr><td><b>Semester:</b></td><td><b>2</b></td><td></td><td> &nbsp;&nbsp;&nbsp;&nbsp;<b> Result:&nbsp;&nbsp;FIRST CLASS </b></td></tr></table><hr><table><tr><td width=250>Subject</td><td width=60 align=center>External </td><td width=60 align=center>Internal</td><td align=center width=60>Total</td><td align=center width=60>Result</td></tr><br><tr><td width=250><i>Engineering Maths - II (06MAT21)</i></td><td width=60 align=center>51</td><td width=60 align=center>16</td><td width=60 align=center>67</td><td  width=60 align=center><b>P</b></td></tr><tr><td width=250><i>Engineering Chemistry (06CHE22)</i></td><td width=60 align=center>40</td><td width=60 align=center>17</td><td width=60 align=center>57</td><td width=60 align=center><b>P</b></td></tr><tr><td width=250><i>Computer Concepts and C Programming (06CCP23)</i></td><td width=60 align=center>70</td><td width=60 align=center>23</td><td width=60 align=center>93</td><td width=60 align=center><b>P</b></td></tr><tr><td width=250><i>Computer Aided Engineering Drawing (06CED24)</i></td><td width=60 align=center>50</td><td width=60 align=center>16</td><td width=60 align=center>66</td><td width=60 align=center><b>P</b></td></tr><tr><td width=250><i>Basic Electronics (06ELN25)</i></td><td width=60 align=center>42</td><td width=60 align=center>17</td><td width=60 align=center>59</td><td width=60 align=center><b>P</b></td></tr><tr><td width=250><i>Computer Programming Lab (06CPL26)</i></td><td width=60 align=center>46</td><td width=60 align=center>24</td><td width=60 align=center>70</td><td width=60 align=center><b>P</b></td></tr><tr><td width=250><i>Engg. Chemistry Lab (06CHEL27)</i></td><td width=60 align=center>41</td><td width=60 align=center>19</td><td width=60 align=center>60</td><td width=60 align=center><b>P</b></td></tr><tr><td width=250><i>Environmental Studies (06CIV28)</i></td><td width=60 align=center>48</td><td width=60 align=center>25</td><td width=60 align=center>73</td><td width=60 align=center><b>P</b></td></tr></table><br><br><table><tr><td></td><td></td><td>Total Marks:</td><td> 545 &nbsp;&nbsp;&nbsp; </td></tr></table>";
function get_result_for_this_sem($semArray)
{

preg_match("/Semester:<\/b><\/td><td><b>(.)<\/b>/",$semArray,$temp1);
$sem_no=$temp1[1];
preg_match("/Result:&nbsp;&nbsp;(.+)<\/b><\/td><\/tr><\/table><hr><table>/U",$semArray,$temp2);
$sem_final_result=$temp2[1];
preg_match_all("/<i>((.+?)\((.+?)\))<\/i><\/td><td width=60 align=center>([0-9]{1,3})<\/td><td width=60 align=center>([0-9]{1,2})<\/td><td width=60 align=center>([0-9]{1,3})<\/td><td  width=60 align=center><b>(.)<\/b><\/td><\/tr>/",$semArray,$temp3,PREG_SET_ORDER);

print_r($temp3);

}
get_result_for_this_sem($semArray);
?>

İşte alıyorum çıktı:

Array ( [0] => Array ( [0] => Engineering Maths - II (06MAT21)511667P  [1] => Engineering Maths - II (06MAT21) [2] => Engineering Maths - II [3] => 06MAT21 [4] => 51 [5] => 16 [6] => 67 [7] => P ) )

0 Cevap