One of the tasks I usually come across while working on some of the more commercial web applications is to display a number in INR i.e Indian National Rupee ( ₹ ) format which makes it really easy to perceive the number as Indian Rupees. Let me show you how to format a number to […]
- Codeigniter
- ...
Upload base64 to file in PHP
While we have working with API for mobile or web application , You will notice that they will send the format of images in Base64 encoded. So in that case, you will need to move the Base64 encoded image to server as a image file.and have to save it in the folder Example Core PHP: […]
Export html table data to Excel using JavaScript or JQuery
If you want to export the html table data to excel using either java script or jquery, comatibale with all browser. You can use below script Call this function on:
Jquery Select2 – Select box with search example code
Select2.js don’t require to add bootstrap js or css. It provides it’s own js and css code. I give you full example of select box with search option. Get more information about select2 : https://select2.org/
T𝗛𝗘 𝗙𝗥𝗢𝗭𝗘𝗡 𝗚𝗔𝗥𝗗𝗘𝗡 𝗥𝗘𝗦𝗢𝗥𝗧
আজকের ভ্রমণ কাহিনীতে আমি আপনাদের খোঁজ দিতে চলেছি কল্লোলিনী কলকাতার খুব কাছে মাত্র 40KM দূরে অবস্থিত সবথেকে সস্তার এবং সুন্দর 𝐏𝐞𝐭 𝐅𝐫𝐢𝐞𝐧𝐝𝐥𝐲 𝐑𝐞𝐬𝐨𝐫𝐭 🐕, তাই চাইলেই আপনি আপনার পোষ্য কেও এখানে আনতে পারেন,আর পাবেন সম্পূর্ণ গ্রামের শান্ত পরিবেশ যেখানে জলে চরে বেড়াই হাঁস 🦢 রয়েছে কত রকমের ফুলের ফলের গাছ 💐🌼🌲🌴যেখানে রুমের ভাড়া সবচেয়ে কম। […]
Convert amount into Word Format In Rupee
public function getIndianCurrency(float $number)
{
$decimal = round($number - ($no = floor($number)), 2) * 100;
$hundred = null;
$digits_length = strlen($no);
$i = 0;
$str = array();
$words = array(0 => '', 1 => 'one', 2 => 'two',
3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six',
7 => 'seven', 8 => 'eight', 9 => 'nine',
10 => 'ten', 11 => 'eleven', 12 => 'twelve',
13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen',
16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen',
19 => 'nineteen', 20 => 'twenty', 30 => 'thirty',
40 => 'forty', 50 => 'fifty', 60 => 'sixty',
70 => 'seventy', 80 => 'eighty', 90 => 'ninety');
$digits = array('', 'hundred','thousand','lakh', 'crore');
while( $i < $digits_length ) {
$divider = ($i == 2) ? 10 : 100;
$number = floor($no % $divider);
$no = floor($no / $divider);
$i += $divider == 10 ? 1 : 2;
if ($number) {
$plural = (($counter = count($str)) && $number > 9) ? 's' : null;
$hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
$str [] = ($number < 21) ? $words[$number].' '. $digits[$counter]. $plural.' '.$hundred:$words[floor($number / 10) * 10].' '.$words[$number % 10]. ' '.$digits[$counter].$plural.' '.$hundred;
} else $str[] = null;
}
$Rupees = implode('', array_reverse($str));
$paise = ($decimal > 0) ? "." . ($words[$decimal / 10] . " " . $words[$decimal % 10]) . ' Paise' : '';
return ($Rupees ? $Rupees . 'Rupees ' : '') . $paise;
}
Get User IP address
function get_client_ip_server() {
$ipaddress = '';
if ($_SERVER['HTTP_CLIENT_IP'])
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if($_SERVER['HTTP_X_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if($_SERVER['HTTP_X_FORWARDED'])
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if($_SERVER['HTTP_FORWARDED_FOR'])
$ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
else if($_SERVER['HTTP_FORWARDED'])
$ipaddress = $_SERVER['HTTP_FORWARDED'];
else if($_SERVER['REMOTE_ADDR'])
$ipaddress = $_SERVER['REMOTE_ADDR'];
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
}
Convert Number into Word Format In PHP
function convert_number($number) {
$ci = & get_instance();
if (($number < 0) || ($number > 999999999)) {
throw new Exception("Number is out of range");
}
$Gn = floor($number / 100000);
/* Millions (giga) */
$number -= $Gn * 100000;
$kn = floor($number / 1000);
/* Thousands (kilo) */
$number -= $kn * 1000;
$Hn = floor($number / 100);
/* Hundreds (hecto) */
$number -= $Hn * 100;
$Dn = floor($number / 10);
/* Tens (deca) */
$n = $number % 10;
/* Ones */
$res = "";
if ($Gn) {
$res .= convert_number($Gn) . " Lakh";
}
if ($kn) {
$res .= (empty($res) ? "" : " ") . convert_number($kn) . " Thousand";
}
if ($Hn) {
$res .= (empty($res) ? "" : " ") . convert_number($Hn) . " Hundred";
}
$ones = array("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen");
$tens = array("", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eigthy", "Ninety");
if ($Dn || $n) {
if (!empty($res)) {
$res .= " and ";
}
if ($Dn < 2) {
$res .= $ones[$Dn * 10 + $n];
} else {
$res .= $tens[$Dn];
if ($n) {
$res .= " " . $ones[$n];
}
}
}
if (empty($res)) {
$res = "zero";
}
return $res;
}
Child Theme In WordPress
In WordPress, a child theme is considered a sub-theme that gets all of its features, style, and functionality from the parent theme. These are safe ways to make changes to the WordPress theme without really modifying the files of the parent theme. When the parent theme is updated, all of the changes made in the child theme […]