Skip to content

Instantly share code, notes, and snippets.

@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'),
@shubhamoy
shubhamoy / gist:a49e51340407ac78dd1a
Last active August 29, 2015 14:11
PHP Group: Code Correction
public function check($username)
{
static $rule=null;
if(is_null($rule))
{
$rule = [$username => 'unique:login'];
}
//$validation=Validator::make(array([$username=>$username]),$rule);
$validation=Validator::make(array(['username'=>$username]), $rule);
if($validation->passes())