str-repleace-array-in-select.php


Quell Code


<?php

$test = "test1, test2, test3, test4";

$htmlOption = '<option>' . str_replace(", ", "</option>\n<option>" , $test) . '</option>';
?>
<!doctype html>
...
<body>

    <select class="form-control" id="test">       
        <?= $htmlOption; ?>
    </select>


Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0