php explode the values and make spaces -
i have string in database. sorry can change database.
tueslunch|monlunch|mondinner|tuesbkfast
so has days name dinner, lunch , bkfast want make string show in php this
tues lunch mon lunch mon dinner tues bkfast
i have done far
$weekdays = tueslunch|monlunch|mondinner|tuesbkfast; $days = explode('|',$weekdays);
so can tell me how this? , suggestions appreciable. thanks
you can use regular expressions this:
$weekdays = "tueslunch|monlunch|mondinner|tuesbkfast"; $days = explode('|', $weekdays); $strings = []; foreach ($days $day) { preg_match_all('/[a-z][^a-z]*/', $day, $results); $strings[] = implode($results[0], ' '); } print_r($strings);
Comments
Post a Comment