< >

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>

Add Comment

* Required information
1000
Powered by Commentics

Comments (1)

Gravatar
Admin
Sascha65says...

Die Canvas Balken Uhr ist ja mal Fett