Answer the question
In order to leave comments, you need to log in
How to create a regular expression to display words separated by commas?
Good afternoon!
There is a string of the form: 110, 50, 42, 69
Purpose: to extract what is between the commas, for subsequent conversion to the form
<div id="bus_tag">110</div><div id="bus_tag">50</div>
etc. Answer the question
In order to leave comments, you need to log in
$str = explode(', ', '110, 50, 42, 69');
foreach($str as $val){
echo '<div id="bus_tag">' . $val . '</div>';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question