Advertisement
Guest User

Untitled

a guest
Oct 28th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. // 135 chars – supposing notices are silenced through error_reporting
  2. function f($n,&$l){foreach(str_split($n)as$c){$b=0;foreach([9=>0,Z=>A,z=>a]as$m=>$i)$c<=$m&&$c>=$i&&$b=join(range($i,$c));$l.=$b?:$c;}}
  3.  
  4. // 147 chars – the same without notices
  5. function f($n,&$l){foreach(str_split($n)as$c){$b=0;foreach(['9'=>'0','Z'=>'A','z'=>'a']as$m=>$i)$c<=$m&&$c>=$i&&$b=join(range($i,$c));$l.=$b?:$c;}}
  6.  
  7. // 140 chars – still no notices, but less strings
  8. function f($n,&$l){foreach(str_split($n)as$c){$b=0;foreach(['90','ZA','za']as$m)$c<=$m[0]&&$c>=$m[1]&&$b=join(range($m[1],$c));$l.=$b?:$c;}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement