regex find ->

0 Cevap php


I have this code!

<div class="time\54>  
<div class="time\98">  
<div class="time\69">  
<div id="result">{INFO}</div>  

Geçen almak gerekir

'<div class="time\69">'

Then take numbers in this last div after 'time',and sum it (6+9), then put result into {INFO} field.
Need use only preg_replace

Sonuç:

<div class="time\54>  
<div class="time\98">  
<div class="time\69">  
<div id="result">15</div>  

How to take last child (element div)?
How to do a sum of numbers?
How to remember (use $1 , or %1) ?
Thx.

0 Cevap