note 84485 deleted from function.str-pad by mgf

From: Date: Mon, 21 Jul 2008 10:55:59 +0000
Subject: note 84485 deleted from function.str-pad by mgf
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142413@lists.php.net to get a copy of this message
Note Submitter: kangoeroe at gmail dot com Reason: 2 ---- If you want to pad strings to a certain length in a REALLY performant way then you should use a binary OR instead. For example: <? $padded = "Short" | " "; ?> This gives the same result as: <? $padded = str_pad("Short", 10); ?> On my machine the first version is about 250% faster and provides the exact same result.

« previous php.notes (#142413) next »