RSS Feed

Category Archives: PHP

symfony swift mailer localhost [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA-v4

A weird problem was put in front of me today. Every symfony site using swift mailer, bar one, on the same server were sending email correctly. Tailing the mail logs the following error was returned: Server xm-mta[19908]: oAJA1IcU019908: localhost [127.0.0.1] …

Posted in PHP

PHP: Decode WINDOWS-1252 character encoding

Recently I came across a character encoding that I didn’t recognise, WINDOWS-1252. Being a Windows character encoding it’s not at all surprising that I didn’t recognise it/do not like it. The solution to decoding such encoded strings is actually pretty …

Posted in PHP

Detect if user input contains prohibited tags

Inspired by my previous article on XSS I thought I’d show a quick, simple and nice way to detect if user input contains some form of script or prohibited tags. Thankfully PHP developers have a function known as strip_tags. This …

Posted in PHP

Know when to use double quotes – A second look

Based on the response I got from JaTaMan I thought it would be a good idea to add an additional post about single and double quote usage in PHP. JaTaMan pointed out that a colleague of his used the new …

Posted in PHP

Know when to use double quotes

PHP is a great server side language to get into however more often than not developers are not aware of performance issues in their code. One issue is the use of double quotes for all string variables. While this is …

Posted in PHP

PHP: fgetcsv(), fgets() and file() line ending detection issues

Having problems with fgetcsv(), fgets() or file() incorrectly detecting line endings? Not a problem! Depending on the operating system in which the file was created the line endings tend to be different: Linux: \n OS X: \n Windows: \r\n

Posted in PHP