public static function isSymbol($s)
 {
     $__tmp = strlen($s);
     if ($__tmp == 0) {
         return false;
     }
     $ch = $s[0];
     if (isDigit($ch)) {
         return false;
     }
     for ($i = 0; $i < $__tmp; $i++) {
         $ch = $s[$i];
         if (!(isChar($ch) || isDigit($ch) || $ch == '_')) {
             return false;
         }
     }
     return true;
 }
function isAlnum($char)
{
    return isAlpha($char) || isDigit($char);
}
<?php

function isDigit($aString)
{
    $len = strlen($aString);
    for ($i = 0; $i < $len; $i++) {
        $theChar = $aString[$i];
        if ($theChar < '0' || $theChar > '9') {
            return false;
        }
    }
    return true;
}
foreach (file($argv[1]) as $line) {
    $list = explode(",", trim($line));
    $words = array();
    $digits = array();
    foreach ($list as $element) {
        if (isDigit($element)) {
            $digits[] = $element;
        } else {
            $words[] = $element;
        }
    }
    echo implode(",", $words);
    if (count($words) > 0 && count($digits) > 0) {
        echo "|";
    }
    echo implode(",", $digits);
    echo "\n";
}