Is the leading colon for parameter names passed to PDOStatement::bindParam() optional?

No, since the documentation doesn’t mention this I think it’s safe to assume that this behaviour isn’t officially supported and shouldn’t be relied upon.

However, it does actually happen to work (in PHP 5.3.24 at least) – internally a colon will be added to the parameter if it’s missing (see ext/pdo/pdo_stmt.c:363 in the PHP 5.3.24 source code).

Leave a Comment