fork download
  1. <?php
  2.  
  3. // your code goes here
  4.  
  5. $input = '3370.01b';
  6. $output = preg_replace_callback('/(?=.*\d)(.*)([-.])(.*)/i', function($matches){return strtoupper($matches[0]);}, $input);
  7.  
  8. echo $output."\n";
  9.  
  10. $input = 'mixed-up';
  11. $output = preg_replace_callback('/(?=.*\d)(.*)([-.])(.*)/i', function($matches){return strtoupper($matches[0]);}, $input);
  12.  
  13. echo $output;
Success #stdin #stdout 0s 82624KB
stdin
Standard input is empty
stdout
3370.01B
mixed-up