I tried to Remove all content with [Brackets] from my String and also use mb_strtoupper. But it doesn't work.
I want to get:
<artist> <![CDATA[ MALARKEY FT. STEVYN ]]> </artist> <title> <![CDATA[ TO YOU ]]> </title>
But I get:
<artist> <![CDATA[ MALARKEY FT. STEVYN ]]> </artist> <title> <![CDATA[ TO YOU [DOMASTIC REMIX] ]]> </title>
Here is my code:
$Length = 25;
$rnd = substr(str_shuffle(md5(time())), 0, $Length);
$songs = [];
$channels = range(1,6);
// Download current songs (from 1 to 6)
foreach ($channels as $sid) {
$song = file_get_contents(sprintf('http://31.214.240.175:8000/currentsong?sid=%s', $sid));
list($artist, $title) = explode(' - ', $song, 2);
$actualImageUrl = sprintf('http://31.214.240.175:8000/playingart?sid=%s&rnd=%s', $sid, $rnd);
$placeholderImageUrl = "http://www.reyfm.de/img/nocover.png";
$imageUrl = @getimagesize($actualImageUrl) ? $actualImageUrl : $placeholderImageUrl;
$songs[] = [
'rnd' => $rnd,
'sid' => $sid,
'image' => $imageUrl,
'song' => $song,
'artist' => trim($artist),
'title' => trim($title),
'artist' => preg_replace('~\[.*\]~' , "", $artist),
'title' => preg_replace('~\[.*\]~' , "", $title),
'artist' => mb_strtoupper($artist),
'title' => mb_strtoupper($title),
];
}
unset($song);
Some ideas?