replaced substr with php shim

Signed-off-by: Nick Brook <nick@rmpenterprise.co.uk>