fork download
  1. <?php
  2.  
  3. $var = "package-name-1.0.5.00124.4";
  4.  
  5. $name = preg_replace('/-[0-9.]+$/', '', $var);
  6. echo "$name\n";
  7.  
  8. $name = rtrim($var, '0123456789.-');
  9. echo "$name\n";
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
package-name
package-name