Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Last active September 10, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbvf50mobile/51d709c20da6987b3d943b168643ff51 to your computer and use it in GitHub Desktop.
Save lbvf50mobile/51d709c20da6987b3d943b168643ff51 to your computer and use it in GitHub Desktop.
Just PHP FUN 099.
<?php
# https://www.codewars.com/kata/58223370aef9fc03fd000071/ Dashatize it.
function dashatize(int $num): string {
$x = strval(abs($num));
$x = preg_replace('/(([02468]+)|[13579])/','-\1',$x);
return trim($x,'-');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment