See code below. I want to sort the option tags by name, not by id.
Here is my code:
<?php
$string = '<option id=a1>Sinead Shannon Roche<option id=a2>Emile Abossolo Mbo<option id=a3>Youssouf Djaoro<option id=a4>Dioucounda Koma';
$new_string = '';
$s = explode('<', $string);
asort($s);
foreach($s AS $v) {
$new_string = $new_string . '<' . $v;
}
// I want $new_string to be "<option id=a4>Dioucounda Koma<option id=a2>Emile Abossolo Mbo<option id=a1>Sinead Shannon Roche<option id=a3>Youssouf Djaoro"
?>