This file contains 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
function persian_digit($text){ | |
$text = str_replace('0' , '٠' , $text); | |
$text = str_replace('1' , '١' , $text); | |
$text = str_replace('2' , '٢' , $text); | |
$text = str_replace('3' , '٣' , $text); | |
$text = str_replace('4' , '۴' , $text); | |
$text = str_replace('5' , '۵' , $text); | |
$text = str_replace('6' , '۶' , $text); | |
$text = str_replace('7' , '٧' , $text); | |
$text = str_replace('8' , '٨' , $text); |
This file contains 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
$(document).ready(function(){ | |
convert_number_to_persion(); | |
}); | |
function convert_number_to_persion() { | |
persian = {0: '۰', 1: '۱', 2: '۲', 3: '۳', 4: '۴', 5: '۵', 6: '۶', 7: '۷', 8: '۸', 9: '۹'}; | |
function traverse(el) { | |
if (el.nodeType == 3) { | |
var list = el.data.match(/[0-9]/g); | |
if (list != null && list.length != 0) { |
This file contains 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
CREATE TABLE `cities` ( | |
`id` int(11) NOT NULL auto_increment, | |
`cid` int(11) default NULL, | |
`cityname` varchar(200) character set utf8 collate utf8_persian_ci default NULL, | |
PRIMARY KEY (`id`)); | |
CREATE TABLE `state` ( | |
`id` int(11) NOT NULL auto_increment, | |
`statename` varchar(200) character set utf8 collate utf8_persian_ci default NULL, | |
PRIMARY KEY (`id`)); |
This file contains 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 | |
/* | |
SimpleXLSX php class v0.6.8 | |
MS Excel 2007 workbooks reader | |
Example 1: | |
$xlsx = new SimpleXLSX('book.xlsx'); | |
print_r( $xlsx->rows() ); | |
Example 2: |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<title>ASCII Image</title> | |
</head> | |
<body> | |
<?php | |
function ascii_image($image) { | |
$result = ''; | |
if(file_exists($_GET['image'])) { |
This file contains 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 | |
function randomColor() { | |
$str = '#'; | |
for($i = 0 ; $i < 6 ; $i++) { | |
$randNum = rand(0 , 15); | |
switch ($randNum) { | |
case 10: $randNum = 'A'; break; | |
case 11: $randNum = 'B'; break; | |
case 12: $randNum = 'C'; break; | |
case 13: $randNum = 'D'; break; |
This file contains 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 | |
function wordofday(){ | |
$filename = "words.txt"; | |
$handle = fopen($filename, "r"); | |
$contents = fread($handle, filesize($filename)); | |
fclose($handle); | |
$array = explode("\n",$contents); | |
$date = date("z"); | |
if($date > count($array)){ | |
return $array[0]; |
This file contains 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 | |
function birthday($birthday){ | |
$age = strtotime($birthday); | |
if($age === FALSE){ | |
return FALSE; | |
} | |
list($y1,$m1,$d1) = explode("-",date("Y-m-d",$age)); | |
$now = strtotime("now"); | |
list($y2,$m2,$d2) = explode("-",date("Y-m-d",$now)); | |
$age = $y2 - $y1; |
This file contains 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 | |
function countrylist($action = 'dropdown', $selectedid = null) { | |
$country_list = array( | |
"Afghanistan", | |
"Albania", | |
"Algeria", | |
"Andorra", | |
"Angola", | |
"Antigua and Barbuda", | |
"Argentina", |
This file contains 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 | |
// This is for Central Standard Time | |
ini_set('date.timezone','America/Chicago'); | |
echo '<p>'.date("g:i A").'</p>'; | |
ini_set('date.timezone','Asia/Tehran'); | |
echo '<p>'.date("g:i A").'</p>'; | |
?> |
NewerOlder