oracle - php compare two strings and create one based on part of the string -
i have 2 php strings comes oracle:
array (size=4) 0 => string '30 jan 2014| 09:00-10:00 | workshop' (length=61) 1 => string '30 jan 2014| 10:00-11:00 | workshop' (length=61) 2 => string '06 feb 2014| 09:00-10:00 | workshop' (length=61) 3 => string '06 feb 2014| 10:00-11:00 | workshop' (length=61)
..and i'm looking way this:
array (size=4) 0 => string '30 jan 2014 | 09:00-11:00 | workshop' (length=61) 1 => string '06 jan 2014 | 09:00-11:00 | workshop' (length=61)
basically combine 2 same-date records 1 combined time... need while getting record in
foreach($result $row){}
loop.. advice appreciated. thanks
basically need keep track of previous date in variable , can compare on next loop iteration. after doing comparison update contains current value. next iteration can same comparison , variable assignment.
basic idea:
$current_date = ''; foreach($result $row){ // date here $date = 'get date string here'; // check if ($current_date === $date) { // } // save date next iteration $current_date = $date; }
Comments
Post a Comment