Aug 19

A Better Way to Handle HTML Field Arrays With PHP

Adding HTML fields so that when they get submitted back to the server in an array format is easy, but what about when you want to group multiple fields together to make up a single entry? Most of the time, that’s when things get a bit tricky. In order for the array fields [...]


May 14

Incorrect FALSE result for PHP’s strpos() function

All too often, I see code like this, attempting to test if a particular string is found in a variable:

$test = ‘abc123′;
if(strpos($test, ‘abc’)) {
// do comething
}

This statement is actually a common mistake, because the strpos() function returns the integer position of the first found letter in the string searched for. [...]


Feb 22

Having Problems with PHP’s SimpleXML and SOAP Results?

SimpleXML does not correctly parse SOAP XML results if the result comes back with colons ‘:’ in a tag, like <soap:Envelope>. Why? Because SimpleXML treats the colon character ‘:’ as an XML namespace, and places the entire contents of the SOAP XML result inside a namespace within the SimpleXML object. There is [...]


Feb 4

PHP Error - Warning: Cannot modify header information - headers already sent by …

This post is a HOWTO article about how to resolve the PHP Error “Warning: Cannot modify header information - headers already sent by …”. This post provides the cause, an explanation, and a resolution for the error.