- substr: documentation ( source)
- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
- str_replace: documentation ( source)
<?php
$tags = "-10 ayanami_rei";
preg_match_all('/-\d+/', $tags, $matches);
var_dump($matches);
if ($matches[0]){
$loop = substr($matches[0],1,strlen($matches[0]));
$tags = str_replace("{$matches[0]} ","",$tags);
$loop = ($loop >=11 ? 10 : $loop);
} else {
$loop = 1;
}
for ($i = 1; $i <= $loop; $i++) {
echo $tags;
}