PHP Puzzlers #2

Here’s another short post detailing some odd behavior in PHP.

Let’s have a look at the following simple piece of code:

$arr = array(
  1 => 'Hello',
  1.5 =>'World',
  true=>"!"
);
var_dump($arr);

What would the output of this be? Surprisingly this does the following:

array(1) {
  [1]=>
  string(1 ...
more ...

PHP Versions

Common Crawl is a fantastic project which provides search data to people. This provides an opportunity for smaller companies to create a search engine using the results, among other things.

By default PHP adds an “X-Powered-By” header which provides the PHP version. Since the common crawl data also provides header ...

more ...

PHP Puzzlers #1

PHP has some idiosyncrasies that can cause odd or counter intuitive behavior. This will be a series of short posts covering some of these situations.

Let’s have a look at the following simple piece of code:

$arr = array('foo','bar','baz');


foreach($arr as &$item){
   echo "First array: ".$item ...
more ...

SuiteCRM Nice Relationships

Module builder and studio are both great tools. They allow simple customisation of a SuiteCRM instance without having to know all the inner workings of SuiteCRM. In particular studio and module builder allows specifying relationships between modules.

However these relationships can leave a lot to be desired. The generated relationship ...

more ...

Generators In PHP

PHP 5.5 added a really nice feature: Generators.

Generators allow you to create a function that returns an list of items without having to create a (possibly very large) array first.

Here’s a simple “classic” generator example. Suppose you wanted to create a range function (PHP provides this ...

more ...

SuiteCRM List View Conditional Formatting

Sometimes you will want to format fields that are shown on the list view depending on the values. For example you may want to colour the direction field on calls differently or to highlight quotes that expire soon.

In this post we’ll be adding a simple coloured border to the “Industry” field in the Accounts list view. more ...


SuiteCRM Command Line Install

You may occasionally want to install SuiteCRM from some automated process. SuiteCRM provides a way to do a “Silent” install which, when given a config_si.php file containing some of the installation details will perform an install.

The steps involved are quite straightforward. First off we create a config_si.php ...

more ...

Large imports in SuiteCRM

For an upcoming post on performance tuning I’ve been playing around with larger databases. To do this I wrote a small script which would insert (possibly) millions of rows. This presented a problem however. Inserting the data was taking a very long time and I was keen to have ...

more ...

Switching to pelican

For some time I’ve ran this blog on Wordpress and I’ve had no complaints. Wordpress is a mature and very powerful platform.

However in my case that turns out to be it’s undoing. I blog at most once a week (it’s been much less than that ...

more ...

GitHub and BitBucket backups

Being mildly paranoid about my data I sometimes worry what would happen to my repositories and gists on GitHub and BitBucket (mid way through drafting this post GitHub went down. Just because you’re paranoid doesn’t mean they’re not after you!). Luckily both these services provide an API ...

more ...