- explode: documentation ( source)
<?php
$data = "balıkesir:şanlıurfa:statyum-ankara
kırıkkale:kocaeli:statyum-ankara
van:mardin:statyum-ankara
ağrı:trabzon:statyum-ankara
elazığ:hatay:statyum-ankara";
$list = explode(PHP_EOL, $data);
foreach($list as $l) {
$items = explode(":", $l);
if (count($items) > 0 ) {
echo $items[2] . "#" . $items[0] . ":" . $items[1] . "\n";
}
}
?>