Skip to content

Instantly share code, notes, and snippets.

View commix's full-sized avatar

Commix Communications Inc commix

View GitHub Profile
@commix
commix / gist:3830892
Created October 4, 2012 01:04
PHP: Print Defined Variables
<?php
$vars = get_defined_vars();
echo '<pre>' . print_r($vars, 1) . '</pre>';
?>
@commix
commix / gist:3822015
Created October 2, 2012 18:21 — forked from mpezzi/gist:1171581
PHP: Validate - Phone Number
/**
* Validate a phone number.
*
* @param $value
* A phone number as string.
* @param $formats
* The formats to validate for.
* @return
* TRUE or FALSE if it validates.
*/
@commix
commix / gist:3822011
Created October 2, 2012 18:20 — forked from mpezzi/gist:1171590
PHP: Validate - Postal Code
/**
* Validate a postal code.
*
* @param $value
* A postal code as string.
* @param $country
* The country postal code format.
* @return
* TRUE or FALSE if it validates.
*/
@commix
commix / gist:1287276
Created October 14, 2011 14:30 — forked from mpezzi/gist:1287269
PHP: Validate - Human Name
/**
* Validate a Human Name
*
* @param $name
* A name as a string.
* @return
* TRUE or FALSE if name is a valid human name.
*/
function valid_human_name($name) {
return preg_match("/^[A-Z][a-zA-Z '&-]*[A-Za-z]$/", $name);