note 84485 added to function.str-pad

From: Date: Wed, 16 Jul 2008 13:16:20 +0000
Subject: note 84485 added to function.str-pad
Groups: php.notes 
Request: Send a blank email to php-notes+get-141564@lists.php.net to get a copy of this message
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 second version is about 250% faster and provides the exact same result. ---- Server IP: 195.207.10.20 Probable Submitter: 194.78.5.130 ---- Manual Page -- http://www.php.net/manual/en/function.str-pad.php Edit -- https://master.php.net/note/edit/84485 Del: integrated -- https://master.php.net/note/delete/84485/integrated Del: useless -- https://master.php.net/note/delete/84485/useless Del: bad code -- https://master.php.net/note/delete/84485/bad+code Del: spam -- https://master.php.net/note/delete/84485/spam Del: non-english -- https://master.php.net/note/delete/84485/non-english Del: in docs -- https://master.php.net/note/delete/84485/in+docs Del: other reasons-- https://master.php.net/note/delete/84485 Reject -- https://master.php.net/note/reject/84485 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141564) next »