-
Notifications
You must be signed in to change notification settings - Fork 0
/
_core.php
26 lines (23 loc) · 1.06 KB
/
_core.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
<?php
require "phpedb.php";
// database config
$db=new database();
$db->db="database_name"; // MODIFY
$db->connect("localhost", "root", "*****"); // MODIFY
// utils
function convert2english($string) {
// This code copied from stackoverflow answer...
$newNumbers = range(0, 9);
// 1. Persian HTML decimal
$persianDecimal = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
// 2. Arabic HTML decimal
$arabicDecimal = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩');
// 3. Arabic Numeric
$arabic = array('٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩');
// 4. Persian Numeric
$persian = array('۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹');
$string = str_replace($persianDecimal, $newNumbers, $string);
$string = str_replace($arabicDecimal, $newNumbers, $string);
$string = str_replace($arabic, $newNumbers, $string);
return str_replace($persian, $newNumbers, $string);
}