Created
January 30, 2013 09:56
-
-
Save alixaxel/4672080 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public static function Enclose($string, $delimiter = null) | |
| { | |
| if (strlen($string = trim($string)) > 0) | |
| { | |
| $string = sprintf('%2$s%1$s%2$s', trim($string, $delimiter), $delimiter); | |
| } | |
| return $string; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@xeoncross: No, not really - I'm just used to sprintf. That's a nice minification BTW. ;)