I have this code. 

```
<?php
    $USClass = "3/312";
    $USClass = preg_replace_callback('~[\d.]+/[\d.]+~', function ($matches) {
    $parts = explode('/', $matches[0]);
    return $parts[1] . ',' . $parts[0];
    }, $USClass);
    echo $USClass;
?>

```

It prints 312,3 which is what I wanted. 

However, if I give an input like **D12/336** then it does not work. I want it to print **336,D12**

How can I do it? and What is wrong with my current code which is not handling this Alphanumeric? Is it because I used \d ?

**EDIT:**

I want it to handle inputs like this as well 

**148/DIG.111**

then the output should be **DIG.111,148**