-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
34 lines (24 loc) · 839 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* @author Payam Yasaie
* @copyright 2019/05/04
* @package farsi-word-maker
*/
//ini_set("display_error", 0);
//error_reporting(0);
require 'app/lib/functions.php';
$word = isset($_GET['word']) ? $_GET['word'] : '';
if ($word) {
$len = strlen($word) / 2;
$len = (isset($_GET['len']) and $_GET['len'] < $len) ? (int)$_GET['len'] : $len;
$words_file = file_get_contents(__DIR__ . "/app/db/$len-letters.json");
$words = json_decode($words_file, true);
$letters = preg_split('//u', $word, 0, 1);
$results = explode(',', makeWords($letters, $len));
$results = array_unique($results);
$results = array_filter($results, function($d) use ($words) {
return in_array($d, $words);
});
sort($results);
}
include "app/layout/index.php";