Skip to content

Instantly share code, notes, and snippets.

View josephilipraja's full-sized avatar

Jose Philip Raja josephilipraja

View GitHub Profile
@josephilipraja
josephilipraja / countries.php
Last active April 17, 2024 05:42
List of Countries with Country code & Telephone (Dial) Code as a PHP Array. Bonus: PHP function to list all Countries as HTML Select Tag Options with their 2 character Country code as values
<?php
$countryArray = array(
'AD'=>array('name'=>'ANDORRA','code'=>'376'),
'AE'=>array('name'=>'UNITED ARAB EMIRATES','code'=>'971'),
'AF'=>array('name'=>'AFGHANISTAN','code'=>'93'),
'AG'=>array('name'=>'ANTIGUA AND BARBUDA','code'=>'1268'),
'AI'=>array('name'=>'ANGUILLA','code'=>'1264'),
'AL'=>array('name'=>'ALBANIA','code'=>'355'),
'AM'=>array('name'=>'ARMENIA','code'=>'374'),
'AN'=>array('name'=>'NETHERLANDS ANTILLES','code'=>'599'),
@josephilipraja
josephilipraja / google-recaptcha-verification.php
Last active February 7, 2021 14:39
Simple PHP Server-side verification of Google re-Captcha.
<?php
if(isset($_POST['g-recaptcha-response']) && !empty($_POST['g-recaptcha-response'])):
// Your site secret key obtained from Google
$secret = '#####################################';
$grResponse = $_POST['g-recaptcha-response'];
// Verify with Google Servers
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$grResponse);
$responseData = json_decode($verifyResponse);
@josephilipraja
josephilipraja / Indian-States-and-Districts-PHP-Array.min.php
Last active November 20, 2020 18:51
Indian States & their Districts as PHP Array with 2 char State Code and in ascending order. Data fetched from http://districts.gov.in as on 21 Apr, 2018.
<?php
// Minified Indian-States-and-Districts-PHP-Array.php
// https://gist.github.com/josephilipraja/de1d4aa351f8dd75f3e486cd47fe9881
$IndianStates = ['AN'=>['name'=>'Andaman and Nicobar Island (UT)','districts'=>['Nicobar','North and Middle Andaman','South Andaman'],],'AP'=>['name'=>'Andhra Pradesh','districts'=>['Anantapur','Chittoor','East Godavari','Guntur','Krishna','Kurnool','Prakasam','Srikakulam','Sri Potti Sriramulu Nellore','Visakhapatnam','Vizianagaram','West Godavari','YSR District,Kadapa (Cuddapah)'],],'AR'=>['name'=>'Arunachal Pradesh','districts'=>['Anjaw','Changlang','Dibang Valley','East Kameng','East Siang','Kra Daadi','Kurung Kumey','Lohit','Longding','Lower Dibang Valley','Lower Siang','Lower Subansiri','Namsai','Papum Pare','Siang','Tawang','Tirap','Upper Siang','Upper Subansiri','West Kameng','West Siang'],],'AS'=>['name'=>'Assam','districts'=>['Baksa','Barpeta','Biswanath','Bongaigaon','Cachar','Charaideo','Chirang','Darrang','Dhemaji','Dhubri','Dibrugarh','Dima Hasao (North Cachar Hil