arrays - How to retrieve data from string in php? -


i have array 1 : monday, tuesday, wednesday, thursday, friday, saturday,. have each day separately , each 1 need need add checkbox near .thank help.

you need store days array able loop through them foreach loop.

<?php $days = array(     'monday',     'tuesday',     'wednesday',     'thursday',     'friday',     'saturday',     'sunday' );  foreach($days $day) {     echo $day;     echo '<input type="checkbox">'; } ?> 

update:

as have stored days string, need explode string convert array can loop through them.

<?php $days = "monday, tuesday, wednesday, thurday, friday, saturday, sunday"; $days = explode(", ", $days);  foreach($days $day) {     echo $day;     echo '<input type="checkbox">'; } ?> 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -