Skip to content

Commit 08f9788

Browse files
authored
Added cycled text convertor
1 parent ba5c34c commit 08f9788

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

decorator.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
11
<?php
22

33
class Decorator {
4-
4+
private $upper;
5+
private $lower;
6+
private $nums;
7+
private $origin;
8+
9+
void __construct(){
10+
$upper = range('A', 'Z');
11+
$lower = range('a', 'z');
12+
$nums = range('0','9');
13+
$origin = $lower + $upper + $nums;
14+
}
15+
16+
public function cycle($text){
17+
$id_upper = range(9398,9423);
18+
$id_lower = range(9324,9449);
19+
$id_nums = [9450] + range(9312,9320);
20+
$id = $id_lower + $id_upper + $id_nums;
21+
$map = [];
22+
foreach($id as $val)
23+
{
24+
$myval = "\u{$val}";
25+
$myval = json_decode($myval);
26+
$map = $map + [$myval];
27+
}
28+
return str_replace($original, $map, $text);
29+
}
530
}
631

732
?>

0 commit comments

Comments
 (0)