How To Trim Whitespace From Exploded Elements In PHP

Author: , May 7th, 2012

Here is a one-liner that explodes a string and trims whitespace from each element: $array = array_map(‘trim’,explode(‘,’,$str));

How to Calculate the Last Day of the Month in PHP

Author: , April 24th, 2012

$lastDay = date(“Y-m-t”, strtotime(“-3 months”)); $firstDay = date(“Y-m-01”, strtotime(“-3 months”));

How To Convert HTML Entity Codes To Plain Text

Author: , April 10th, 2012

Using Perl: use HTML::Entities; my $plainText = decode_entities(‘Put text to convert here’); Using PHP: $plainText = html_entity_decode(‘Put text to convert here’,ENT_QUOTES,’UTF-8′);

How To Add To The Include Path In PHP

Author: , March 21st, 2012

set_include_path(get_include_path().PATH_SEPARATOR.'{DESIRED_NEW_PATH_TO_ADD}’);

How To Cleanup Hacked WordPress PHP Code Using A Perl Script

Author: , March 21st, 2012

Perl to the Rescue! This perl script cleans just one type of infection as an example. Vary the script to search for and clean other combinations and patterns. Also, the script is deliberately written long-hand and verbose, and could be significantly more compact and efficient. It was done this way for ease of use and […]

How To Move A File Safely In PHP:

Author: , March 3rd, 2012

Safely move a file in PHP:

How To Pass A Reference To An Existing Object From One Class To Another In PHP

Author: , February 2nd, 2012

Inside class “yourClassA” calling “yourClassB”:

Inside class “yourClassB” getting the call from “yourClassA”:

How To Display Rows From MySQL Using PHP And Smarty v2

Author: , January 27th, 2012

The PHP

The Smarty Template

How To Call Functions Within Classes Dynamically In PHP

Author: , January 19th, 2012

How To Escape Newlines In PHP For Javascript

Author: , January 11th, 2012

You must use all three lines together for it to work…YMMV: