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
vConsole
22:22:07
Uncaught TypeError: Cannot read properties of null (reading 'style')
/Kurze-Scripte-und-Codeschnipsel/index.php?name=str-repleace-array-in-select.php&ordner=Kurze-Scripte-und-Codeschnipsel:5446:53
22:22:08
Uncaught SyntaxError: Unexpected token '<'
/js/index.php?js=3.2.1-jquery.min.js:4:22481
22:22:08
Uncaught SyntaxError: Unexpected token '<'
/js/index.php?js=MooTools.min.js:5:5095
22:22:08
Uncaught SyntaxError: Unexpected token '<'
/js/index.php?js=EnlighterJS.min.js:3:17773
22:22:08
Uncaught TypeError: window.addEvent is not a function
/Kurze-Scripte-und-Codeschnipsel/index.php?name=str-repleace-array-in-select.php&ordner=Kurze-Scripte-und-Codeschnipsel:2786:8
22:22:08
Uncaught SyntaxError: Unexpected token '<'
/js/index.php?js=pace.js:896:26
22:22:08
Uncaught SyntaxError: Unexpected token '<'
/js/index.php?js=cookieconsent.min.js:1:20809
22:22:08
Uncaught SyntaxError: Unexpected token '<'
/js/alljs.php:408:2
22:22:08
500
22:22:07
WeChatLib: 0 (xxxx.xx.xx)
22:22:08
System: Unknown
22:22:08
Protocol: HTTPS
22:22:08
UA: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
22:22:08
navigationStart: 1744323726660
22:22:08
navigation: 0ms
22:22:08
dns: 0ms
22:22:08
tcp: 0ms
22:22:08
request: 668ms
22:22:08
response: 4ms
22:22:08
domComplete (domLoaded): 1107ms (716ms)
22:22:08
loadEvent: 15ms
22:22:08
total (DOM): 2059ms (2044ms)