<?php $string = '225/50R17'; $filtered = preg_replace('~[a-z]+~i', '/', $string); $exploded = explode('/', $filtered); foreach($exploded as $one){ if (!empty($one)){ echo "<b> ".$one."</b>"; } }