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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -