Skip to content

Instantly share code, notes, and snippets.

View felds's full-sized avatar
:shipit:

Luiz “Felds” Liscia felds

:shipit:
View GitHub Profile
<?php
/**
* Escapes scalar values deeply
*
* Examples:
* <code>
* var_export(mysql_real_escape_string_deep(1));
* // outputs '1'
*
@felds
felds / validate_rfc_2822_email.function.php
Created March 10, 2011 13:09
Checks if an email is a valid RFC 2822 email address
<?php
/**
* Checks if an email is a valid RFC 2822 email address
*
* Examples:
* <code>
* <?php
* validate_email('dev@felds.com.br'); // returns true
* validate_email('Felds Liscia <dev@felds.com.br>'); // returns false
@felds
felds / gist:210646
Created October 15, 2009 03:40
Instructions on using DomDocument class on PHP 5
<?php
// Setting the document header
header('content-type: application/xml; charset=UTF-8');
// Instantiating a new DomDoc obj.
$xml = new DomDocument('1.0','UTF-8');
$xml->formatOutput = true;
// Creating a root element and assigning it to $xmlRoot variable