Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

coding standards fix by php-cs-fixer

  • Loading branch information...
commit 9e79c4da80c9bf97ec8f71fb7fd6dd8639b85696 1 parent 3993991
heartsentwined authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/Heartsentwined/Utf8/Utf8.php
View
6 src/Heartsentwined/Utf8/Utf8.php
@@ -8,7 +8,7 @@ class Utf8
/**
* UTF-8 version of chr()
*
- * @param int|float|string $num ('numeric')
+ * @param int|float|string $num ('numeric')
* @return string
*/
public static function uchr($num)
@@ -19,13 +19,14 @@ public static function uchr($num)
if($num<=0x7FF) return chr(($num>>6)+192).chr(($num&63)+128);
if($num<=0xFFFF) return chr(($num>>12)+224).chr((($num>>6)&63)+128).chr(($num&63)+128);
if($num<=0x1FFFFF) return chr(($num>>18)+240).chr((($num>>12)&63)+128).chr((($num>>6)&63)+128).chr(($num&63)+128);
+
return '';
}
/**
* UTF-8 version of ord()
*
- * @param string $c
+ * @param string $c
* @return int
*/
public static function uord($c)
@@ -38,6 +39,7 @@ public static function uord($c)
$ord1 = ord($c{1}); if ($ord0>=192 && $ord0<=223) return ($ord0-192)*64 + ($ord1-128);
$ord2 = ord($c{2}); if ($ord0>=224 && $ord0<=239) return ($ord0-224)*4096 + ($ord1-128)*64 + ($ord2-128);
$ord3 = ord($c{3}); if ($ord0>=240 && $ord0<=247) return ($ord0-240)*262144 + ($ord1-128)*4096 + ($ord2-128)*64 + ($ord3-128);
+
return false;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.